Omnet
Omnet
OMNeT++
OMNeT++ is an object-oriented modular discrete
event network simulation framework. It has a
generic architecture, so it can be (and has been)
used in various problem domains:
◦ Modeling of wired and wireless communication networks
◦ Protocol modeling
◦ Modeling of queueing networks
◦ Modeling of multiprocessors and other distributed
hardware systems
◦ Validating of hardware architectures
◦ Evaluating performance aspects of complex software
systems
Modeling Concepts
OMNeT++ provides efficient tools for the
user to describe the structure of the actual
system. Some of the main features are:
◦ Hierarchically nested modules
◦ Modules are instances of module types
◦ Modules communicate with messages through
channels
◦ Flexible module parameters
◦ Topology description language
Hierarchical Modules
compound modules
Modules
Communication
Modules communicate by exchanging message
Gates
◦ Input and output interfaces of modules
Each connection (also called link) is created
within a single level of the module hierarchy
Within a compound module,
◦ One can connect the corresponding gates of two
submodules
◦ Gate of one submodule and a gate of the compound
module
Connections
Parameters:
◦ Bit error rate
Probability that a bit is incorrectly transmitted, and
allows for simple noisy channel modeling.
◦ Propagation Delay
Amount of time the arrival of the message is delayed
by when it travels through the channel.
◦ Data rate
used for calculating transmission time of a packet
Parameters
Modules can have parameters. Parameters
can be assigned either in the NED files or the
configuration file omnetpp.ini.
description of a network.
Network description may consist of a number
Import directives
Channel definitions
Network definitions
Identifiers
Identifiers are the names of modules,
channels, networks, submodules, parameters,
gates, channel attributes and functions.
◦ Reserved words should not be used.
channel ChannelName
//...
endchannel
Optional attributes:
◦ Error
◦ Delay
◦ datarate
Channel Definition Example
channel LeasedLine
delay 0.0018 // sec
error 1e-8
datarate 128000 // bit/sec
endchannel
Simple Module
upper-case letters.
A simple module is defined by declaring its
parameters:
numCPUs=input(10, "No of processors?");
// default value, prompt
processingTime = input(10ms);
// prompt text
cacheSize = input;
‘gatesizes’ Keyword
module CompoundModule
parameters:
numPorts: const;
submodules:
node1: Node
gatesizes:
inputs[2], outputs[2];
node2: Node
gatesizes:
inputs[numPorts], outputs[numPorts];
//...
endmodule
Connections definition
Connections are specified in the connections:
section of a compound module definition.
By default, NED requires that all gates be
connected. Since this check can be inconvenient at
times, it can be turned off using the nocheck
modifier.
EXAMPLE
connections nocheck:
node1.output --> node2.input;
node1.input <-- node2.output;
//...
Connections Definition
The gate++ notation allows you to extend a gate vector with new
gates, without having to declare the vector size in advance with
gatesizes
module SmallNet
simple Node submodules:
gates: node: Node[6];
connections:
in: in[]; node[0].out++ --> node[1].in++;
node[0].in++ <-- node[1].out++;
out: out[]; node[1].out++ -->node[2].in++;
endsimple node[1].in++ <-- node[2].out++;
node[1].out++ --> node[4].in++;
node[1].in++ <-- node[4].out++;
node[3].out++ --> node[4].in++;
node[3].in++ <-- node[4].out++;
node[4].out++ --> node[5].in++;
node[4].in++ <-- node[5].out++;
endmodule
Constants
Numeric and string
constants
◦ Decimal or scientific
notations.
String constants
◦ Uses double quotes.
Time constants
◦ Seconds, milliseconds,
minutes or hours
Demo
Create a project
Simple module tic-toc
Network initialisation
Omnetpp.ini file
Running of a project
Add icon to tic toc and color
Watch variable declare in class
Self message using schedule at
How to use parameters in modules in cc files
Derived class
Losing packet and resending it again
Create a channel
Gate vector
statistics