![]() |
![]() ![]() ![]() |
![]() |
![]() |
|||||
![]() |
||||||||
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
![]() |
![]() |
![]() |
|||||
![]() ![]() ![]() |
Tutorial Stuff Basics The basic idea is that we have a series of nodes (which can be alikened to eth0) connected by links (like a cable). We create a 'node' object by: set n0 [$ns node] and a duplex-link like this: $ns duplex-link <$from_node> <$to_node> <$pipe_thickness> <$delay> <$type> usually, $type is of DropTail. Then for each node, we must assign an 'Agent'. In the examples of the tutorials, we use UDP datagrams. This is done via, set <source_name> [new Agent/UDP] and to assign the Agent to a node we define, $ns attach-agent <$node> <$source> for each type of agent, there are various parameters such as packetSize_ etc. which can be defined. We must also assign the type of traffic that will flow on the link using, set <traffic_type> [new Application/Traffic/<type>] and setting it to the <source_name> <$traffic_type> attach-agent <source_name> As the definition language for the Agents, Nodes and Links are written in oTcl, we can use for and if loops to define a mesh of objects. Jumping a few tutorials, i Implemented a simple network like this: In this case, nodes {0,1,2} generate exponential UDP traffic of Agent type Application/Traffic/Exponential, with rates of {100k, 200k, 300k}, all towards node 4. We want to monitor the outcome of the traffic at node 4. The Tcl file is here. To monitor a sink, we have to assign a [new Agent/Loss Monitor] to each. eg. set <sink> [new Agent/LossMonitor] We also need a record procedure that outputs the results of each sink to a file, each time resetting the total amount of data held inside each LossMonitor Agent. We then have to respawn this procedure from within so that it takes readinds every $time seconds. we write to a file using: puts <$file_handle> "text" In order to do anything, we have to define start and stop points for ns, and we do this through: $ns at <time> "<$source_traffic> {start|stop}" And finally run the simulation with $ns run Results with 0.1 second readings: with 0.5 second readings: with 1.0 second readings: The main difference's is the resolution of the results. Another Example Set a queue length of n between two nodes, set queue-limit <$node1> <$node2> <n>
|
|||||||
![]() |
![]() |
![]() |
||||||
![]() |
![]() |
![]() |
||||||
© 2001-2003, Yee-Ting Li, email: ytl@hep.ucl.ac.uk,
Tel: +44 (0) 20 7679 1376, Fax: +44 (0) 20 7679 7145 Room D14, High Energy Particle Physics, Dept. of Physics & Astronomy, UCL, Gower St, London, WC1E 6BT |
||||||||
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |