Professional Documents
Culture Documents
Contents
Initialization and termination Definition of a network of links and nodes Agents and applications Scheduling events Visualisation: using nam Tracing Random variables
NS Simulator
NS Simulator
At the end of the ns program we should call the procedure finish and specify at what time the termination should occur.
NS Simulator
NS Simulator
NS Simulator
NS Simulator
NS Simulator
NS Simulator
Scheduling events
The Tcl script defines when event should occur.
Format
Examples
The scheduler is started when running ns, i.e. through the command $ns run.
NS Simulator Networking Laboratory 10/24
NS Simulator
Tracing
Tracing objects in a simplex link
EnqT registers information concerning a packet that arrives and is queued at the input queue of the link. DrpT handles the information concerning the dropped packet. DeqT registers information at the instant the packet is dequed. RecvT gives us information about packets that have been received at the output of the link.
NS Simulator Networking Laboratory 12/24
Tracing
Structure of trace files
Time: the time at which the events occurs. From node: givens the input node of the link at which the events occurs. To node: fives the output node of the link at which the events occurs. Pkt id: unique id of the packet
NS Simulator Networking Laboratory 13/24
Tracing
Example
NS Simulator
Random variables
Seeds and generators
The seed value of 0 results in the generation of a new random variable each time we run the simulation. In contrast, if we use other seeds then each time we run the simulation, the same sequence of random variables that are generated in a simulation will be generated.
When actually creating a random variable, we have to define its distribution type and its parameters.
NS Simulator Networking Laboratory 15/24
Random variables
NS Simulator
Random variables
NS Simulator
Random variables
NS Simulator
Sungkyunkwan University
Chapter 3. How to work with trace files 2007-04-14 Jeonghoon Park hypnos2000@skku.edu
NS Simulator
Examples
Averaging the values in column 4 of a file
NS Simulator
Using grep
The grep command allows us to filter a file. Example
Output traces in ns may contain all types packets that go through all links and we may be interested only in the data concerning tcp packets that went from node 0 to node 2. We may wish to obtain a file containing all lines of tr1.tr begin with the letter r. If we wish to make a file of all the lines that begin with s and have later tcp 1020 we should type
NS Simulator
Example
Produce a curve that is smaller than the default. Produce points that are larger than the defaults. Tells gnuplot where to put the key Restricts the range of the x axis. Superimposes three curves in a single figure
NS Simulator
NS Simulator
Example
NS Simulator