create new tag
, view all tags

Simulation of Packet-Switching Networks

By doing the tutorials we have learnt a great deal of stuff on using OMNeT++ for modeling and simulation. But, we only dealt with small scale models, the methods we use do not capture some important elements of packet-switched network dynamics, and some methods we used are clearly not scalable. Some important issues we need to address are

  • Hard-coding of the routing tables becomes very cumbersome when network size gets bigger. Two solutions are possible:
    1. Write a routing algorithm to automatically populate the routing tables (if your research is on routing algorithms, you will have to do this). Or,
    2. use built-in topology discovery and shortest-path functionality (see Section 7.6 of the user manual) of OMNeT++ (quick solution, we will use this one)
  • Introduce different kinds of nodes to model traffic sources and packet-switches.
  • Introduce some general purpose modules to create different kinds of nodes by assembling them various ways. In this tutorial we will create two simple modules: network layer and application. Then we will assemble router compound module by using the network layer and host compound module by using both the application and network layer simple modules.
  • We will add a traffic source model to the hosts (in the application module).
  • We will add packet queues to the output ports.
  • Finally, we will introduce more realistic link definitions into the network topology.

A Packet-switching network of two routers and four hosts

Let's create a packet switching network of 2 routers and 4 hosts (as shown in the following diagram).

The NED files are:
  • pkswitch_net.ned: network topology is defined here.
  • modules.ned: common modules used by hosts and routers are defined here (AppGen, AppSink, NetworkLayer, PDropTailQueue and Server).
  • host.ned: a host. We assemble a host by putting together one AppGen, one AppSink, one NetworkLayer one PDropTailQueue and one Server module.
  • router.ned: a router. We assemble a router by putting together one NetworkLayer and multiple paired PDroptailQueue and Server modules. We populate the routing tables of the routers by using the built-in Dijkstra algorithm of OMNeT++ when simulation starts (i.e. we don't have a routing algorithm implemented here).
The C++ implementations of the simple modules are: And others required to complete the simulation model:
  • packet.msg: packet model.
  • pk_geometric.cc: my (shifted) geometric distribution routine, used for generating packet sizes with a given minimum size and average.
  • omnetpp.ini: simulation configuration file.
To run the simulation, do these:
  1. Create an empty project, titled say "pkswitch_net". OMNeT++ will create the "pkswitch_net" directory under your selected workspace, and will create a file "package.ned" under it. Delete "package.ned" (I need to check why this is so)
  2. Copy above files into the "pkswitch_net" directory.
  3. Then run "Build Project" under the "Project" pull-down menu.
You are now ready to run the pkswitch_net.

Observing and recording the statistics

I have included quite a few number of statistics collection facilities of OMNeT++ (which we have learned about them in the TicToc 11 tutorial) in the C++ code of the simple modules. We can observe the following when we run the simulations (see the figure below):

  1. Output queue lengths
  2. Output queue length distribution histograms
  3. Output queue length Vs time plots
  4. Number of packets generated and received by hosts
  5. Packet size distribution histograms at the receivers (sinks)
  6. Hop count distribution histograms of the packets received at the sinks
  7. End-to-end packet delay distribution histograms at the sinks
pkswitch net stats.png
The histogram plots and graphs are accessible by double clicking on the icon of a simple module and choosing the "contents" tab (you need to double click on the variable you want to observe).

For postprocessing, the simulation will also record two files: omnetpp.vec and omnetpp.sca. you will find in the code that I ask OMNeT++ to record the progression of queue lengths and statistics on number of generated and received packets in each host, end-to-end packet delays, packet sizes and hop counts. When the simulation ends, in the working directory there should be two files created:

  1. omnetpp.vec the queue size progression data, and
  2. omnetpp.sca the collected statistics on various network data, such as average end-to-end delays, number of generated and received packets etc.
They are ordinary text files, you can look into them, process them through perl, awk, sed or similar tools to extract and/or combine data. You can also use OMNeT++'s own scalars and plove tools (as introduced in the TicToc tutorials). Let's first investigate the contents of the scalars.sca file by issuing this command: scalars omnetpp.sca. You will see that there are lots of things we can check. Let's say we are particularly interested in the number of packets generated by each host. We choose #received as the scalar name of interest, then "apply filter" to reduce the list. Afterwards, if click on the "bar chart" icon at the top, we get the following graph:
no of received packets.png
The graph shows the number packets generated by the app_gen module of each host. As one can expect, the number of generated packets for each host is pretty close.

In the next tutorial we will use this network to run a series of simulations to generate a graph of offered traffic Vs average end-to-end delay.

Topic revision: r7 - 2013-06-11 - AhmetSekercioglu
This site is powered by the TWiki collaboration platformCopyright © 2008-2017 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback