May 26, 2008 ... OMNeT++ is an object-oriented modular discrete event network simulator. .....
Adding parameters In this step you'll learn how to add input.
Intro TicToc tutorial Collecting results Visualizing the results
Introduzione a OMNeT++ Dott. Ing. Carlo Crociani; Dott. Ing. Luca Filipponi Dipartimento di informatica e sistemistica A.Ruberti
May 26, 2008
Dott. Ing. Carlo Crociani; Dott. Ing. Luca Filipponi
Introduzione a OMNeT++
Intro TicToc tutorial Collecting results Visualizing the results
1
Introduction
2
TicToc tutorial
3
Adding statistics collection
4
Visualizing the results with Plove and Scalars
Dott. Ing. Carlo Crociani; Dott. Ing. Luca Filipponi
Introduzione a OMNeT++
Intro TicToc tutorial Collecting results Visualizing the results
Basics
OMNeT++ is an object-oriented modular discrete event network simulator. It 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.
Dott. Ing. Carlo Crociani; Dott. Ing. Luca Filipponi
Introduzione a OMNeT++
Intro TicToc tutorial Collecting results Visualizing the results
OMNeT++ provides efficient tools for the user to describe the structure of the actual system. Some of the main features are: 1
hierarchically nested modules
2
modules are instances of module types
3
modules communicate with messages through channels
4
flexible module parameters
5
topology description language
Dott. Ing. Carlo Crociani; Dott. Ing. Luca Filipponi
Introduzione a OMNeT++
Intro TicToc tutorial Collecting results Visualizing the results
Modeling concepts
An OMNeT++ model consists of hierarchically nested modules, which communicate by passing messages to each another. The depth of module nesting is not limited; this allows the user to reflect the logical structure of the actual system in the model structure.
Dott. Ing. Carlo Crociani; Dott. Ing. Luca Filipponi
Introduzione a OMNeT++
Intro TicToc tutorial Collecting results Visualizing the results
Type of Modules
Compound modules: Modules that contain submodules
Dott. Ing. Carlo Crociani; Dott. Ing. Luca Filipponi
Introduzione a OMNeT++
Intro TicToc tutorial Collecting results Visualizing the results
Type of Modules
Compound modules: Modules that contain submodules Simple modules:contain the algorithms in the model, implemented in C++, using the OMNeT++ simulation class library.
Dott. Ing. Carlo Crociani; Dott. Ing. Luca Filipponi
Introduzione a OMNeT++
Intro TicToc tutorial Collecting results Visualizing the results
Messages
Modules communicate by exchanging messages. Messages can represent frames or packets in a computer network, or other types of mobile entities. Messages can contain arbitrarily complex data structures. Simple modules can send messages either directly to their destination or along a predefined path, through gates and connections. The “local simulation time” of a module advances when the module receives a message. The message can arrive from another module or from the same module (self-messages are used to implement timers).
Dott. Ing. Carlo Crociani; Dott. Ing. Luca Filipponi
Introduzione a OMNeT++
Intro TicToc tutorial Collecting results Visualizing the results
Gates connections
Gates are the input and output interfaces of modules; messages are sent out through output gates and arrive through input gates. 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, or a gate of one submodule and a gate of the compound module.
Dott. Ing. Carlo Crociani; Dott. Ing. Luca Filipponi
Introduzione a OMNeT++
Intro TicToc tutorial Collecting results Visualizing the results
Connections
Connections can be assigned three parameters, which facilitate the modeling of communication networks: 1
propagation delay
One can specify link parameters individually for each connection, or define link types and use them throughout the whole model.
Dott. Ing. Carlo Crociani; Dott. Ing. Luca Filipponi
Introduzione a OMNeT++
Intro TicToc tutorial Collecting results Visualizing the results
Connections
Connections can be assigned three parameters, which facilitate the modeling of communication networks: 1
propagation delay
2
bit error rate
One can specify link parameters individually for each connection, or define link types and use them throughout the whole model.
Dott. Ing. Carlo Crociani; Dott. Ing. Luca Filipponi
Introduzione a OMNeT++
Intro TicToc tutorial Collecting results Visualizing the results
Connections
Connections can be assigned three parameters, which facilitate the modeling of communication networks: 1
propagation delay
2
bit error rate
3
data rate
One can specify link parameters individually for each connection, or define link types and use them throughout the whole model.
Dott. Ing. Carlo Crociani; Dott. Ing. Luca Filipponi
Introduzione a OMNeT++
Intro TicToc tutorial Collecting results Visualizing the results
Parameters
Modules can have parameters. Parameters can be assigned either in the NED files or the configuration file omnetpp.ini. Parameters may be used to customize simple module behaviour, and for parameterizing the model topology. Parameters can take string, numeric or boolean values, or can contain XML data trees. Numeric values include expressions using other parameters and calling C functions, random variables from different distributions, and values input interactively by the user. Numeric-valued parameters can be used to construct topologies in a flexible way. Within a compound module, parameters can define the number of submodules, number of gates, and the way the internal connections are made.
Dott. Ing. Carlo Crociani; Dott. Ing. Luca Filipponi
Introduzione a OMNeT++
Intro TicToc tutorial Collecting results Visualizing the results
Programming the algorithms
The simple modules of a model contain algorithms as C++ functions and use simulation objects (messages, modules, queues etc.) that 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
Dott. Ing. Carlo Crociani; Dott. Ing. Luca Filipponi
Introduzione a OMNeT++
Intro TicToc tutorial Collecting results Visualizing the results
OMNeT++ model
An OMNeT++ model consists of the following parts: NED language topology description(s) (.ned files) which describe the module structure with parameters, gates etc. Message definitions (.msg files). You can define various message types and add data fields to them. Simple modules sources. They are C++ files, with .h/.cc suffix. OMNeT++ will translate module and message definitions into C++ classes.
Dott. Ing. Carlo Crociani; Dott. Ing. Luca Filipponi
Introduzione a OMNeT++
Intro TicToc tutorial Collecting results Visualizing the results
The simulation system
The Omnet++ simulation system provides the following components: Simulation kernel. This contains the code that manages the simulation and the simulation class library. It is written in C++, compiled and put together to form a library (a file with .a or .lib extension) User interfaces written in C++, compiled and put together into libraries (.a or .lib files).
Dott. Ing. Carlo Crociani; Dott. Ing. Luca Filipponi
Introduzione a OMNeT++
Intro TicToc tutorial Collecting results Visualizing the results
Building the simulation program
Simulation programs are built using the user defined files and the simulation system components. First, .msg and .ned files are translated into C++ code using the opp msgc and nedtool program. Then all C++ sources are compiled, and linked with the simulation kernel and a user interface library to form a simulation executable.
Dott. Ing. Carlo Crociani; Dott. Ing. Luca Filipponi
Introduzione a OMNeT++
Intro TicToc tutorial Collecting results Visualizing the results
Running the simulation and analyzing the results
The simulation executable is a standalone program. When the program is started, it reads a configuration file (omnetpp.ini). This file contains settings that control how the simulation is executed, values for model parameters, etc The output of the simulation is written into data files: output vector files, output scalar files , and possibly the user’s own output files. OMNeT++ provides a GUI tool named Plove to view and plot the contents of output vector files. Output scalar files can be visualized using the Scalars tool.
Dott. Ing. Carlo Crociani; Dott. Ing. Luca Filipponi
Introduzione a OMNeT++
Intro TicToc tutorial Collecting results Visualizing the results
The NED language
Identifiers : are used to give name to modules, channels, networks, gates, parameters. Must be composed of letters (a-z, A-Z), numbers (0-9) and the underscore, and may only begin with a letter or the underscore. For identifiers that are composed of several words, the convention is to capitalize the beginning of every word. Also, it is recommended that you begin the names of modules, channels and networks with a capital letter, and the names of parameters, gates and submodules with a lower-case letter. Case sensitivity : all identifiers in it are case sensitive.
Dott. Ing. Carlo Crociani; Dott. Ing. Luca Filipponi
Introduzione a OMNeT++
Intro TicToc tutorial Collecting results Visualizing the results
The NED language(2)
Comments : comments begin with a double slash ’//’, and last until the end of the line. Comments are ignored by the NED compiler. Import:used to import declarations from another network description file. Ex: import ”ethernet”; // imports ethernet.ned
Dott. Ing. Carlo Crociani; Dott. Ing. Luca Filipponi
Introduzione a OMNeT++
Intro TicToc tutorial Collecting results Visualizing the results
TicToc Tutorial for OMNeT++
This short tutorial to OMNeT++ guides you through an example of modeling and simulation, showing you along the way some of the commonly used OMNeT++ features. You’ll find the tutorial much more useful if you actually carry out at least the first steps described here.
Dott. Ing. Carlo Crociani; Dott. Ing. Luca Filipponi
Introduzione a OMNeT++
Intro TicToc tutorial Collecting results Visualizing the results
Note: We assume here that you have a working OMNeT++ installation. We also assume that you have a good C++ knowledge, and you are in general familiar with C/C++ development (editing source files, compiling, debugging etc.) on your operating system. To make the examples easier to follow, all source code in here is cross-linked to the OMNeT++ API documentation. This document and the TicToc model are an expanded version of the original TicToc tutorial from Ahmet Sekercioglu (Monash University).
Dott. Ing. Carlo Crociani; Dott. Ing. Luca Filipponi
Introduzione a OMNeT++
Intro TicToc tutorial Collecting results Visualizing the results
Getting started
Since the most common application area of OMNeT++ is the simulation of telecommunications networks, we’ll borrow our topic from there. For a start, let us begin with a ”network” that consists of two nodes. The nodes will do something simple: one the nodes will create a packet, and the two nodes will keep passing the same packet back and forth. We’ll call the nodes ”tic” and ”toc”. Here are the steps you take to implement your first simulation from scratch: 1
Create a working directory called tictoc, and cd to this directory.
2
Describe your example network by creating a topology file. A topology file is a text file that identifies the network’s nodes and the links between them. You can create it with your favourite text editor. Let’s call it tictoc1.ned:
Dott. Ing. Carlo Crociani; Dott. Ing. Luca Filipponi
Introduzione a OMNeT++
Intro TicToc tutorial Collecting results Visualizing the results
// This file is part of an OMNeT++/OMNEST simulation example. // // Copyright (C) 2003 Ahmet Sekercioglu // Copyright (C) 2003-2005 Andras Varga // // This file is distributed WITHOUT ANY WARRANTY. See the file // ‘license’ for details on this and other legal matters. simple Txc1 gates: in: in; out: out; endsimple // // Two instances (tic and toc) of Txc1 connected both ways. // Tic and toc will pass messages to one another. // module Tictoc1 submodules: tic: Txc1; toc: Txc1; connections: tic.out --> delay 100ms --> toc.in; tic.in