Set color of the packets for a flow specified by the flow id The "Simulator" object memberįunction implementations are located in the " ns-2/tcl/lib/ns-lib.tcl" file. Plumbing functions in the Overview section) and scheduling, however Most of member functions are for simulation setup (referred to as Create connections between agents (ex.Set network component parameters (mostly for compound objects).Connect network component objects created (ex.Create compound objects such as nodes and links (described.The "Simulator" object has member functions that do the following: Select the default address format (ignore this for.Create a scheduler (default is calendar scheduler).Initialize the packet format (ignore this for now).(italics is used for variables and values in this section).
In general,Īn NS script starts with making a Simulator object instance.Īn NS simulator object instance, and assigns it to variable ns The following is the explanation of the script above. The "cbr" is set to start at 0.1 sec and stopĪt 4.5 sec, and "ftp" is set to start at 1.0 sec and stop at 4.0 Respectively, and the "cbr" is configured to generate 1 KByte packetsĪt the rate of 1 Mbps.
"cbr" traffic generator are attached to "tcp" and "udp" agents A "null" agent just frees the packets received. A "udp"Īgent that is attached to n1 is connected to a "null" agent attached To the sender (tcp agent) and frees the received packets. A tcp "sink" agent generates and sends ACK packets As default, the maximum size of a packet that a "tcp" agent can N0, and a connection is established to a tcp "sink" agent attached to The duplex link between n2 and n3 hasġ.7 Mbps of bandwidth and 20 ms of delay. The duplex links between n0 and n2, and n1 and n2 have 2 Mbps This network consists of 4 nodes (n0, n1, n2, n3) as shown in aboveįigure. A Simple Network Topology and Simulation Scenario To run this simulation, download " ns-simple.tcl" and type " ns ns-simple.tcl" at your shell prompt.įigure 4. Example 3 is an OTcl script that creates the simple network configuration and runs the simulation scenario in Figure 4. This section shows a simple NS simulation script and explains what each line does.