Om Net
Om Net
Ved Kushwaha
Agenda
• What is OMNeT++
• Programming Model
• NED language
• Simple modules/messages
• How to run a simulation
What is OMNeT++
• OMNeT++ is a component-based, modular and open-
architecture discrete event network simulator.
• simulator can be used for:
– traffic modeling of telecommunication networks
– protocol modeling
– modeling queuing networks
– modeling multiprocessors and other distributed hardware
systems
– validating hardware architectures
– evaluating performance aspects of complex software systems
– modeling any other system where the discrete event approach
is suitable, e.g. communication networks and other distributed
systems.
OMNET++ Programming model
• Efficient tools for describing the structure of the actual system
• Simulated objects are represented by modules
– Modules can be simple or composed (depth of module nesting is
not limited)
– Modules communicate by messages sent
• directly
• along a predefined path through gates and connections
– One module description consists of :
• Interface description (.NED file)
• Behavior description (C++ class)
• Modules, gates and links can be created:
– Statically - at the beginning of the simulation (NED file)
– Dynamically – during the simulation
OMNET++ Programming model
• Simulation objects are represented by C++ classes.
• The following classes are part of the simulation class
library:
– modules, gates, connections etc.
– parameters
– messages
– container classes (e.g. queue, array)
– data collection classes
– statistic and distribution estimation classes (histograms)
– transient detection and result accuracy detection classes
OMNET++ Programming model
• Model consists of the following parts
– NED language topology description(s) (.ned
files)
– Message definitions (.msg files).
– Simple modules sources. They are C++ files,
with .h/.cc suffix.
– configuration file (usually called omnetpp.ini).
NED Overview
• The NED language has several features
– Hierarchical
– Component-Based
– Interfaces
– Inheritance
– Packages
NED Overview …
• Reserved word
– import channel endchannel simple endsimple
module endmodule error delay datarate const
parameters gates submodules connections
gatesizes if for do endfor network endnetwork
nocheck ref ancestor true false like input
numeric string bool char xml xmldoc
NED Overview …
• Identifiers are the names of modules, channels,
networks, submodules, parameters, gates,
channel attributes and functions.
– must be composed of letters of the English alphabet
(a-z, A-Z), numbers (0-9) and the underscore “_”.
– Identifiers may only begin with a letter or the
underscore.
– it is recommended that the names of modules,
channels and networks with a capital letter, and the
names of parameters, gates and submodules with a
lower-case letter.
NED Overview …
• Case sensitivity
– NED is case sensitive
• Comments
– C / C++ style comments (“//”)
NED Overview …
• There are three distinctive elements that can be
described in a NED file
– Module definitions. In these blocks you can describe simple and
compound modules and set parameters of these modules. Also,
you can define gates that connect the modules.
– Channel definitions. Describe channels (links) that connect
modules.
– Network definitions. To get the whole simulation running, you’ll
have to describe which module is the top level module for the
network you wish to simulate. This top level module is an
instance of the system module.
NED Overview …
• simulation in OMNeT++ is written in two different languages,
NED and C++.
• two languages separate the design of a topology and the
implementation of the modules.
• The topology of a model is specified using the NED language.
• Behavior is encapsulated in C++ models.
• NED description can contain the following components, in
arbitrary number or order:
– import directives
– channel definitions
– simple and compound module definitions
– network definitions
Import directives
• import directive is used to import declarations
from another network description file.
• import "ethernet"; // imports ethernet.ned
• import
"Router",
"StandardHost",
"FlatNetworkConfigurator";
Channel definitions
• Channels encapsulate parameters and behavior
associated with connections
• predefined types are :
– ned.IdealChannel
– ned.DelayChannel
– ned.DatarateChannel
Channel definitions …
channel LeasedLine
delay 0.0018 // sec
error 1e-8
datarate 128000 // bit/sec
endchannel