Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 15

4.

3 OMNeT++ Simulations
Now as we have done with the installation of OMNeT++ and with the build and configuration of
Frameworks as well now lets see what are the basic components that were used in order to run or
make simulations in OMNeT++
(i) Network:
Network in OMNeT++ acts as an object which holds different kinds of modules, sub
modules and defines the network. Modules inside network object can communicate to each other
via links known as channels. Figure 22 shows the network object named as My_ Network
when you run simulation with an empty network means no modules added in a network object.

Figure 1: Network object in OMNeT++

(ii) Module:

A module object is inherited by Network object. A module could be anything which is able to
make communication by sending and receiving data between modules with the help of channels.
Figure 23 show a module named My_Module in a network object named as My_network

Figure 2Module object in OMNeT++

(iii)

Compound Module:

A compound module object is a type of object which contains one or more than one module
inside itself. In simple words a module inside a module is known as compound module. Let us
drag a module named as Standard Host these prebuilt modules can be found easily by
importing framework such as INET , MiXim and many other as well. A sample screen shot of a
compound module in a network is shown in figure 24.

Figure 3:

Compound module object in OMNeT++

When you double click on the module named as Standard_Host you will see the modules
which were compounded inside a standard host module will look like the snap shot given in
figure 25.

Figure 4:

Standard host module object in OMNeT++

In the above figure it can be seen that a module named as standard host have compounded many
other modules inside such as tcp ,udp NICs routing table and many others as shown above.
(iv) Channels:
Channels were the objects that were used to connect both the modules together. A channel
can be Ethernet cable or any other link which connects two modules.
(v) NED language:
NED language stands for Network Description language which means that it is used for to
describe the topology of your network. NED have two option for to create topology one is with
the code editor and the other is with the graphical editor, the graphical editor will make write
code automatically for the module that were dragged into the network object. As far as for the
code editor is concern user have to write each and every step on their own. In figure 26 there
were snap shots of both the code editor view and the graphical one.

Figure 5:

Graphical view of Network (My Network) using NED (Network description file)

Figure 6:

Code editor view of Network (My Network) using NED (Network description file)

In figure 27 there is a coded view of the network that were designed graphically. Parameters for
the respective module can be set by both methods, graphically or by using NED language, in
figure 28 there is a snapshot of how to adjust parameters using graphical view.

Figure 7: Editing Module Parameters using graphical view

(vi) OMNeT++ Configuration file (.ini):


The configuration file known by the extension of .ini file is used to configure the parameters
related to simulation. In every project configuration file is known by the name of omnetpp.ini.
The simulation will not continue or will give an error if there is an error in the file or this file is
misplaced from the folder of the same project that you are currently working on. Figure 29 there
is a snap shot of the configuration file along with the network model.

Figure 8:

Network configuration using graphical view

Figure 9: Network configuration using editor view

4.4 Creating and Running a simulation


Following are the steps for creating a Simulation Model using OMNeT++
Step 1:
Go to file->New->Select OMNeT++ Project.
Step 2:
Enter the project title and click next

Figure 10: Creating a new OMNeT++ Project

Step 3:
If you wish to create your own module based on C++ language, ini files, NED language
select Empty project and click finish
Step 4:
If you wish to create empty project but using the modules from some framework select
Empty project with src and simulation folders and click finish
Step 5:
If you wish to make some changes in modules or in NED, ini files of existing examples
or project select Examples and click finish.
Figure 32 below show all the possible options discussed in the steps above.

Figure 11:

Showing possible options to create a new OMNeT++ Project

4.4.1 Steps for running a Simulation Model using OMNeT++


Step 1:
To run simulations first open the project which you desire to gather simulation result
about.

Figure 12:

Project Explorer window in OMNeT++

Step 2:
After opening the project , select the omnetpp.ini file right click, select run as OMNeT++
simulation. After clicking a window will appear similar to the interface as shown in figure 34.

Figure 13: Running a simulation using OMNeT++

Step 3:
After clicking the run button simulation began to start until the time limit reaches which
will define by the user in .ini file. As in the above image red dot represent the travelling of
acknowledgment packet.

4.5

Result collection and analysis


Main purpose of simulation as we have discussed earlier is to generate the results and

perform calculation on the generated results in order to make improvement in the desired model.
This can be done by collecting the data and analyze it in a correct way to extract the desired
content out of results. For to do so in OMNeT++ we have to make slight change in our
omnetpp.ini file by writing record-event log=true. This will enable the simulation to record the
event as they occur time to time so that event log can be used later on to gather useful results.
There were four types of event log files which were listed by their extensions.
1. abc.elog
2. abc .sca
3. abc.vec

Describes the event log about the simulation.


Stores the scalar data recorded during simulation.
Stores the vector data recorded during simulation.

4. abc.vci Index file for vector file generate help in searching vector files.
In figure 35 there is a snapshot of how the .elog file will look like.

Figure 14:

.elog window in OMNet++

This file shows us the graph of every single event that occurs during simulation. By
double clicking on the red dot enable us to see the detail of a particular event that what actually
happens in that particular event. When we click at red dot automatically the event shifted to
event log tab as shown in figure 36.

Figure 15: Window showing a particular event in OMNeT++

Figure 16: Event log tab in OMNeT++

As we have set event log=true in our ini file which enable the option of recording events
occurring during simulation. At the end of simulation in project explorer window under the
project we can see that a folder named as results was created under which scalar (.sca) and vector
(.vec) files of event were recorded which can be used to plot bar or scatter graphs and these
vector and scalar can be filterized according to the needs of the research . In figure 38 and in
figure 39 there were snapshots which shows how scalar and vector data is used for plotting
graphs.

Figure 17: Showing scalar and vector data recorded from simulation using OMNeT++

Figure 18: Browsing data from simulation using OMNeT++

Now if we want to plot a graph about specific module simply just right click on specific data set
and click on plot. It will generate a bar graph based on histograms as shown in figure 40

Figure 19:

Plotting graph using OMNeT++

You might also like