Friday, September 2, 2011

NS PROGRAMMING STRUCTURE


NS PROGRAMMING STRUCTURE
● Create the event scheduler
● Turn on tracing
● Create network topology
● Create transport connections
● Generate traffic
● Insert errors

NS2 SIMULATION FLOWCHART


NS STRUCTURE


NS STRUCTURE
● NS is an object oriented discrete­event simulator
* Simulator maintains list of events and executes one event after another
* Single thread of control: no locking or race conditions


● Back end is C++ event scheduler
* Protocols mostly
* Fast to run, more control


● Front end is oTCL
* Creating scenarios, extensions to C++ protocols
* fast to write and change






WHY TWO LANGUAGE? (TCL & C++)
• C++: Detailed protocol simulations require systems programming language  
* byte manipulation, packet processing, algorithm implementation
* Run time speed is important
* Turn around time (run simulation, find bug, fix bug, recompile, re-run) is slower


• Tcl: Simulation of slightly varying parameters or configurations
* quickly exploring a number of scenarios
* iteration time (change the model and re -run) is more important

FEATURES OF NS­2


FEATURES OF NS­2
● Protocols: TCP, UDP, HTTP, Routing algorithms, MAC etc
● Traffic Models: CBR, VBR, Web etc
● Error Models: Uniform, bursty etc
● Misc: Radio propagation, Mobility models , Energy Models
● Topology Generation tools
● Visualization tools (NAM), Tracing

HISTORY OF NS-2


HISTORY OF NS-2
ns began development in 1989 as a variant of the REAL network simulator and it is currently maintained by volunteers. Long-running contributions have also come from Sun Microsystems and the UCB Daedelus and Carnegie Mellon Monarch projects
ns-2 was built in C++ and provides a simulation interface through OTcl, an object-oriented dialect of Tcl. 
The user describes a network topology by writing OTcl scripts, and then the main ns-2 program simulates that topology with specified parameters. It runs on Linux, FreeBSD, Solaris, Mac OS X and on Windows using Cygwin. It is licensed for use under version 2 of the GNU General Public License

WHAT IS NS-2?


WHAT IS NS-2?
ns (from network simulator) is a name for series of discrete event network simulators, specifically ns-2 and ns-3. Both simulators are used in the simulation of routing protocols, among others, and are heavily used in ad-hoc networking research, and support popular network protocols, offering simulation results for wired and wireless networks alike.
Both ns-2 and ns-3 are popular in research given their open source model and detailed online documentation
• ns-2 stands for Network Simulator version 2.

NS-2:
• Is a discrete event simulator for networking research
• Work at packet level.
• Provide substantial support to simulate bunch of protocols like TCP, UDP, FTP, HTTP and DSR.
• Simulate wired and wireless network.
• Is primarily Unix based.
• Use TCL as its scripting language.
• ns-2 is a standard experiment environment in research community.

USES OF NETWORK SIMULATORS


USES OF NETWORK SIMULATORS
Network simulators serve a variety of needs. Compared to the cost and time involved in setting up an entire test bed containing multiple networked computers, routers and data links, network simulators are relatively fast and inexpensive. They allow engineers, researchers to test scenarios that might be particularly difficult or expensive to emulate using real hardware - for instance, simulating a scenario with several nodes or experimenting with a new protocol in the network. Network simulators are particularly useful in allowing researchers to test new networking protocols or changes to existing protocols in a controlled and reproducible environment.
Network simulators, as the name suggests are used by researchers, developers and engineers to design various kinds of networks, simulate and then analyze the effect of various parameters on the network performance. A typical network simulator encompasses a wide range of networking technologies and can help the users to build complex networks from basic building blocks such as a variety of nodes and links. With the help of simulators, one can design hierarchical networks using various types of nodes like computers, hubs, bridges, routers, switches, links, mobile units etc.
Various types of Wide Area Network (WAN) technologies like TCP, ATM, IP etc and Local Area Network (LAN) technologies like Ethernet, token rings etc., can all be simulated with a typical simulator and the user can test, analyze various standard results apart from devising some novel protocol or strategy for routing etc. There are a wide variety of network simulators, ranging from the very simple to the very complex. 
Minimally, a network simulator must enable a user to represent a network topology, specifying the nodes on the network, the links between those nodes and the traffic between the nodes. More complicated systems may allow the user to specify everything about the protocols used to handle network traffic. Graphical applications allow users to easily visualize the workings of their simulated environment. Text-based applications may provide a less intuitive interface, but may permit more advanced forms of customization. 
Others, such as GTNets, are programming-oriented, providing a programming framework that the user then customizes to create an application that simulates the networking environment to be tested.