Skip to main content

How to Run TCL File in Network Simulator 2

1. Install NS2 and set the path.

2. After Installing NS2, go the $prompt and run ns filename
For example, ns tcp.tcl (if the file name is tcp.tcl)

3. after the previous statement automatically the .nam and .tr files will be created in the same folder (the tcl file should contain the provision of tracing the nam and trace file.. those examples we will discuss later in the blog)
(nam means Network Animator and tr means Trace file)

4. to see the demo in GUI, run nam tcp.nam
(a window will be opened and you can click the run button )
5. .tr file is actual file helpful to see the performance factors like(throughput, packet drop, etc).
You can parse the .tr file using softwares like tracegraph202(need to download separately) or xgraph( which comes along with ns2)


  1. sir,
    i am in final year of b-tech iam doing in my project "implementation of flow and error control using ns2" so till now i have install ns2 2.29 on ubuntu 9.4

    kindly send me the source code for "implementing flow and error control " as soon as possible.

  2. Dear Sir,
    Im a doing a project on Mobile Adhoc network using ns2 2.34 ,we propose a new routing protocol to support the selection of stable and high speed route in Multi-Rate Mobile Ad-hoc Networks (MANET). We introduce another approach for modeling the mobility aspect under the relation with the variation of communication rate. Maximize the proposed "Route Selection Indicator" (RBI) ensures that the selected route is the most stable, has highest speed among route candidates. Kindly provide me the source code to choose the stable,highspeed route using RSI metric.

  3. hello sir
    i am learner or ns2... how to run .tcl file in ns2

  4. Shilpananda R Hegde26 February 2011 at 12:23

    sir i am pursuing my engineering now and presently belong to 8th semister. I am doing project on
    " Model Based technique for data reliability in wireless sensor network using ns-2". but i didnt know how to implement wireless sensor network using ns2. so please send the source code for implementation...

    waiting for your help

  5. sir,
    hav nstalled ns2 2.34 allinone,but aftr nstallation it is not giving % on wrting ns,rather it is giving
    divya@divya-laptop:~$ ns
    Usage: host [-v] [-a] [-t querytype] [options] name [server]
    Listing: host [-v] [-a] [-t querytype] [options] -l zone [server]
    Hostcount: host [-v] [options] -H [-D] [-E] [-G] zone
    Check soa: host [-v] [options] -C zone
    Addrcheck: host [-v] [options] -A host
    Listing options: [-L level] [-S] [-A] [-p] [-P prefserver] [-N skipzone]
    Common options: [-d] [-f|-F file] [-I chars] [-i|-n] [-q] [-Q] [-T] [-Z]
    Other options: [-c class] [-e] [-m] [-o] [-r] [-R] [-s secs] [-u] [-w]
    Special options: [-O srcaddr] [-j minport] [-J maxport]
    Extended usage: [-x [name ...]] [-X server [name ...]]
    pls help me ,so tht i can start ma project as soon as possible:)

  6. sir
    i m doing my dissertation on the topic of performance evalution of dsdv and aodv routing protoals for wsn. please send me the source code in ns2.34.
    i will be the thankful to you

  7. sir
    i am the new person to work with ns2...while i run the tcl file,the .tr file was create,but the .nam file cant able to create.will u please help me how to create the nam file.thank u.

  8. sir
    i am doing final yr project in wireless sensor network in ns2.34 and i installed ns2.34 in ubuntu 11.04 and successfully runs the tcl files. i need patch for wireless network and the installation steps please help me sir
    thank you sir.

  9. sir,
    i want the sources codesof some wireless routing protocols like dsdv,aodv etc. where can we find or get them.please list the sources..
    with regards

  10. you can find examples in the ns2 source itself.

  11. Very useful website even for the beginners who dont about NS2

  12. Sir,
    I m not be able to wireless scripts on ns2.34 on ubuntu11.04.It gives mobility error plzzzz help me.

  13. Dear Sir,
    Im a doing a project on Mobile Adhoc network using ns2,we propose a new routing protocol to support the selection of stable and high speed route in Multi-Rate Mobile Ad-hoc Networks (MANET). I am installing ns2 on my laptop's window xp by using cygwin. some issues occurred while installing. help me to come out from this dilemma..

  14. sir,how are we going to know or read the output of the trace file??


Post a comment

Popular posts from this blog

Installing TexLive 2019 in Ubuntu 18.04

Installation of TexLive 2019 in Linux (Ubuntu 18.04 LTS)
TeX (Tech)

Installation of TexLive 2019

Please watch the video for full installation

I used .iso file to download, the Total size is 3.3GB for Linux,

and i used the torrent file to download, it took me just 20 min to download the entire .iso file

Extract the .iso file to a folder and open a terminal

$] sudo ./install-tl
(it goes into a terminal mode, which is faster compared to the GUI Mode)

$] sudo ./install-tl -gui
after the installation, set the PATH, MANPATH and INFOPATH as suggested by LATEX

export PATH=$PATH:/usr/local/texlive/2019/bin/x86_64-linux
export MANPATH=/usr/local/texlive/2019/texmf-dist/doc/man
export INFOPATH=/usr/local/texlive/2019/texmf-dist/doc/info

put these lines in to the /home/pradeepkumar/.bashrc

$] gedit /home/pradeepkumar/.bashrc
We have installed TexLive 2019 and texstudio.

To install texstudio

$] sudo apt install texstudio
The look and feel of TexStudio looks like this image.

texlive, it install everyt…

Implementing a new system call in Kernel version 2.6.32

A system call is used by application or user programs to request service from the operating systems. Since the user programs does not have direct access to the kernel whereas the OS has the direct access. OS can access the hardware through system calls only.The following files has to be modified for implementing a system call/usr/src/linux- set of files to be createdCreate a new directory newcall/ inside the path “/usr/src/linux-” Create new files Makefile, newcall.c and put them in the /usr/src/linux- folder Create new user files (in any folder of Linux) to test the system call
testnewcall.c, testnewcall.h (created in /home/pradeepkumar) syscall_table_32.S Find the file /usr/src/linux- and add the following line at the end

Electrical Machine Design (equations)

FactorsDC Machine Transformers Induction Machines Synchronous MachinesOutput EquationPa=CoD2Ln, where Pa=P/h for generators, Pa=P for motorsFor Single Phase
Q=2.22 f Bm Ai Kw Aw d10-3
For Three Phase
Q=3.33 f Bm Ai Kw Aw d 10-3Q=CoD2 L ns
KVA Input Q=
HP * 0.746 / Cos f * hQ=CoD2 L ns
KVA Input Q=
HP * 0.746 / Cos f * h
For Turbo alternators
Q=1.11Bavac KwsVa2 L 10-3/nsOutput CoefficientCo=Bav ac* 10-3where Bav-magnetic loading and ac - electric loadingDNACo=11 Kws Bav ac 10-3Co=11 Kws Bav ac 10-3 Choice of Magnetic LoadingFlux Density in Teeth Frequency of Flux Reversals Size of machineDNAMagnetizing current, Flux Density, Iron lossIron loss, Stability, Voltage Rating, Parallel Operation, Transient ShortCircuit current Choice of Electric LoadingTemperature rise,
speed of machine, Voltage, Armature reaction, CommutationDNAOverload Capacity, Copper losses, Temperature rise, Leakage ReactanceCopper loss, Synchronous reactance, Temperature rise, Stray Load losses,
Voltage rating Flux …