Marc Greis’ ns Tutorial Contents: I. Introduction II. Finding Documentation II For ns&nam II.2 For Tcl II.3 For C++ III. The Basics III.1 Downloading/ Installing. Only the first 94 pages are relevant for Tcl, the rest of the book is about Tk and more complicated aspects of Tcl. I also found a short OTcl Tutorial. Another good . Marc Greis’ Tutorial for the UCB/LBNL/VINT Network Simulator “ns”. I. Introduction [Next section] [Back to the index] Disclaimer: This tutorial was originally.
|Published (Last):||20 April 2014|
|PDF File Size:||1.39 Mb|
|ePub File Size:||3.98 Mb|
|Price:||Free* [*Free Regsitration Required]|
The next lines create a Null agent which acts as traffic sink and attach it to node n1. In this section, you are going to develop a Tcl script for ns which simulates a simple topology. It will get clearer to you once you see what the code does.
Save the file greid.
In the first subsection, we discuss how to create and run a simple 2-node wireless network simulation. Make sure the connection-pattern and node-movement files exist under the directories as declared above. We shall make changes to the script, simple-wireless. The mobilenodes tutodial about within an area whose boundary is defined in this example as mXm. And now we have to tell the CBR agent when to send data and when to stop sending. The usage of movement pattern files and feeding of next hop info to God shall be shown in the example ttutorial the next sub-section.
When you click on the ‘play’ button in the nam window, you will see that after 0. We begin our script simple-wireless. The tutorisl APIs are not available with ns2. Both setdest and calcdest calculate the shortest number of hops between nodes based on the nominal radio range, ignoring any effects that might be introduced by the propagation model in an actual simulation.
Line 7 and 8 should be self-explaining. You can find the relevant parameters for each agent type in the ns manual page. Just as with any other ns simulation, we begin by creating a tcl script for the wireless simulation. However, in order to keep this example simple we avoid using movement pattern files and thus do not provide God with next hop information. A node, a previously created traffic sink, the packet size for the traffic source, the burst greeis idle times for the exponential distribution and the tutorual rate.
The mobilenodes move about within an area whose boundary is defined in this example as mXm. The packetSize is being set to bytes and a packet will be sent every tutoria. I suggest that now you start some experiments greiis nam and the Tcl script. At the end of the simulation run, trace-output file simple. You can download the complete example here if it doesn’t work for you and you think you might have made a mistake.
Thus all pkts destined for nodes 0 ggeis 2 are routed through node 1. Also we are going to set up nam traces. Packets are exchanged between the nodes as they come within hearing range of one another.
More about this is discussed in section XI. MovementTrace, when turned on, shows the movement of the mobilenodes and the trace is marked with M in their 2nd field.
The last line finally starts the simulation. Random node movement files like treis can be generated using CMU’s node-movement generator “setdest”. Next run the simulation in the usual way type at prompt: And finally the command to start the simulation, puts “Starting Simulation The next lines create a Null agent which acts as traffic sink and attach it to node n1. The two CBR agents have to be connected to the Null agent. At the beginning of a wireless simulation, we need to define the type for each of these network components.
Run the script by typing at the prompt: CBR stands for ‘constant bit rate’.
Save the file wireless1. The next line tells the simulator object to execute the ‘finish’ procedure after 5. In addition to the variables LL, MAC, antenna etc that were declared at the beginning of the script, we now define some more parameters like the connection-pattern and node-movement file, x and y values for the topology boundary, a seed value for the random-number generator, time for the simulation to stop, for convinience.
Next setup traffic flow between the two nodes as follows: We will call this file simple-wireless. The path length information provided to god was used by CMU’s Monarch Hreis to analyze the path length optimality of ad hoc network routing protocols, and so was printed out as part of the CMUTrace output for each packet. For details on CMUTraces see chapter 15 of ns documentation.
If you want to download a copy of simple-wireless. Define node movement model puts “Loading connection pattern We are going to use the default value of flat addressing; Also lets turn on only AgentTrace and RouterTrace; You can experiment with tutkrial traces by turning all of them on.
Creating Output Files for Xgraph. If ad-hockey can read your input correctly, its output will be properly formatted for calcdest.
hreis I will explain find a way to distinguish the data flows from the two nodes from each other, and I will show how a queue can be monitored to see how full it is, and how many packets are being discarded. You will have to use the code from this section as starting point in the other sections. Next add the following lines for providing initial position of nodes in nam.
This tutorial chapter uses new node APIs which are not greos in the ns2. As they move away, packets start getting dropped. However as mentioned earlier no traffic flow can be seen not supported as yet.