Presentation is loading. Please wait.

Presentation is loading. Please wait.

Introduction to OMNeT++

Similar presentations


Presentation on theme: "Introduction to OMNeT++"— Presentation transcript:

1 Introduction to OMNeT++
Chia-Hui Huang Wireless and Broadband Network Laboratory (WBNLAB) 2018/12/29

2 Reference Material OMNeT++ User Manual OMNeT++ Wiki
../doc/manual/usman.html ../doc/ide-overview.pdf ../doc/userguide.pdf ../doc/api/index.html OMNeT++ Wiki OMNeT++ mailing list OMNeT++ TicToc Tutorial ../doc/tictoc-tutorial/index.html 相對於其它simulator來說,OMNeT++具有相當完整的參考文件. Ex. NS-2 Wireless and Broadband Network Laboratory (WBNLAB) 2018/12/29

3 Outline Introduction OMNeT++ Installation Modeling concepts
Configuring Simulations Adding functionality to cSimpleModule Demo – SimpleTicToc Analyzing Simulation Results Summary Wireless and Broadband Network Laboratory (WBNLAB) 2018/12/29

4 Introduction Methods for network research Simulation frameworks
Analytical Simulation Simulation frameworks Commercial OPNET QualNeT Free NS-2 (Network Simulator version 2) OMNeT++ Well structured documentation Procedures of research 1. Find interesting topics 2. Read related papers to the topics 3. Choose your research topic(s) 4. Idea about your topic 5. Verify idea by analytical or simulation Wireless and Broadband Network Laboratory (WBNLAB) 2018/12/29

5 Introduction What is OMNeT++ ? Version Purposes
An object-oriented modular discrete event network simulator Event scheduler Version OMNeT++ 3.x OMNeT++ 4.0 Purposes Modeling of wired and wireless communication networks Protocol modeling Modeling queuing networks etc… Advance of time depends on the timing of events Wireless and Broadband Network Laboratory (WBNLAB) 2018/12/29

6 OMNeT++ Installation (OMNeT++ 4.0)
Version 3.x OMNeT++ Installation Guide (Windows XP) Version 4.0 (Windows XP) Download the OMNeT++ source code from The zip archive contains a complete MINGW installation and all additional 3rd party components (perl, tcl/tk, libxml2 etc) MinGW gcc compiler environment omnetpp-<version>/mingwenv.cmd (unix-based env.) ./configure make Test samples (unix-based env. Use ls instead dir/w) ../samples/rundemo Wireless and Broadband Network Laboratory (WBNLAB) 2018/12/29

7 Modeling concepts Module
An OMNeT++ model consists of modules that communicate with message passing Simple & compound module Connection (link) & gates Samples/routing Write a routing protocol as a simple module and embbed on a node INET-framework provides layering model – samples/routing Wireless and Broadband Network Laboratory (WBNLAB) 2018/12/29

8 Component of OMNeT++ Simulation
NED Language Topology Description (.ned) Edited by any text edit or OMNeT++ IDE (graphical, v4.0) Describe the network scenarios and topology Module, channel, and networks Message (Packet) Definition (.msg) Various message types and data fields (new packet/message) OMNeT++ will translate .msg to C++ classes Simple Module Sources (.h/ .cc) Use API provided by OMNeT++ (OMNeT++ API Reference) omnetpp-<version>/doc/api/index.html omnetpp.ini usergide.pdf p.15 – some functions are available only in source editing mode newMessageType.msg Wireless and Broadband Network Laboratory (WBNLAB) 2018/12/29

9 NED Language Topology Description
NED – Network topology Nodes Connections channel Example code : Wireless and Broadband Network Laboratory (WBNLAB) 2018/12/29

10 NED Language Topology Description
NED – Channel New channel type Expected a C++ class to be present Predefined channel types ned.IdealChannel ned.DelayChannel ned.DataRateChannel Example code : Example code : Wireless and Broadband Network Laboratory (WBNLAB) 2018/12/29

11 NED Language Topology Description
NED – Module Simple module Parameters double, int, bool, string, xml … Gates Input and output gates Gate vector by bracket [] Compound module parameters Passed to submodules for initialization Example code : Example code : Wireless and Broadband Network Laboratory (WBNLAB) 2018/12/29

12 Messages Basic Concepts
cMessage is the base class of all message types Events, Messages, Packets, Frames, Cells, Bits or Signals Basic attributes of cMessage Name : string Kind : zero or positive integers Length : bits Bit error flag : bool Priority : used by simulation kernel Time stamp : simtime_t (usage by users) There are some other attributes not mentioned here source/destination module and gate, sending/arrival time …etc. Wireless and Broadband Network Laboratory (WBNLAB) 2018/12/29

13 Messages Basic Concepts
Set/get attributes of cMessage by setXXX()/getXXX() / Duplicate message Information about a Message bool isSelfMessage(); If message is sent by itself message are often used to represent events internal to a module Bool isScheduled(); If message is put into the scheduler Scheduled message can be canceled by cancelEvent() Wireless and Broadband Network Laboratory (WBNLAB) 2018/12/29

14 Message definitions In practice, you’ll need to add various fields to cMessage to make it useful (protocol header fields) Subclass Message definition file (.msg) C++ code is automatically generated form message definition file Saving you a lot of typing mypacket_m.h, mypacket_m.cc Example code : mypacket.msg Example code Tictoc13.msg Wireless and Broadband Network Laboratory (WBNLAB) 2018/12/29

15 Configuring Simulations
Configuration and input data for the simulation are in a configuration file omnetpp.ini (default) Sections [General] section Common parameters network option Selects the model to be set up and run cpu-time-limit The length of simulation time Named configurations Run specific parameters [Config tictoc1], [Config tictoc 2] Example set up : Wireless and Broadband Network Laboratory (WBNLAB) 2018/12/29

16 Configuring Simulations
Section inheritance Missing configuration key or parameter value Fall back to [General] (default) or extends section Example : Wireless and Broadband Network Laboratory (WBNLAB) 2018/12/29

17 Configuring Simulations
User interfaces Tkenv – Tcl/Tk-based graphical, windowing user interface Debug and test Cmdenv – command-line user interface Batch execution Selecting user interface (Makefile) Wireless and Broadband Network Laboratory (WBNLAB) 2018/12/29

18 Simulation steps Wireless and Broadband Network Laboratory (WBNLAB)
2018/12/29

19 Adding functionality to cSimpleModule ( simple module source .h/.cc )
Simple modules encapsulate C++ code that generates events and reacts to events Create simple module types Subclassing the cSimpleModule class Necessary functions This function creates the necessary simple and compound module Parameter set up, initial value … Process events Implement the model’s behavior This function is called when the simulation terminates successfully Free memory, statistic … Wireless and Broadband Network Laboratory (WBNLAB) 2018/12/29

20 Adding functionality to cSimpleModule ( simple module source .h/.cc )
Defining simple module types (.h file) The simple module class has to be registered with OMNeT++ Txc1.cc Wireless and Broadband Network Laboratory (WBNLAB) 2018/12/29

21 Demo - tictoc with two nodes
SimpleTicToc Scenario – .ned Simple module – TXC.ned Parameters - message initiator (controlled by omnetpp.ini) Gates – in/out Network – Tictoc Submodules – two nodes tic and toc Connections – ned.IdealChannel (default) Behavior - .h/.cc The two nodes keep passing the same packet back and forth Omnetpp.ini ticInit tocInit Tictoc scenario Wireless and Broadband Network Laboratory (WBNLAB) 2018/12/29

22 Analyzing Simulation Results
Result files Output Vectors Writing time series data Several times in a simulation Use cOutVector objects The record() method is used to output a value with a timestamp All cOutVector objects write to a single vector file (default - omnetpp.vec) cStatistic is the base class for all statistical data collection classes. cStatistic itself adds no data members or algorithms to cOwnedObject, it only defines virtual functions that will be redefined in descendants. No instance of cStatistic can be created cStdDev - Statistics class to collect min, max, mean, and standard deviation cWeightedStdDev is similar to cStdDev, but accepts weighted observations. cWeightedStdDev can be used for example to calculate time average. It is the only weighted statistics class. cDensityEstBase - Distribution estimation Wireless and Broadband Network Laboratory (WBNLAB) 2018/12/29

23 Analyzing Simulation Results
Result files Output Scalars Usually, once and at finish() in a simulation To record summary data at the end of the simulation To do several runs with different parameter setting Use the recordScalar() function of cSimpleModule (cComponent) The output scalar file is preserved across simulation runs (default – omnetpp.sca) ( vs. output vector file) Mostly, we can create a private member variable with type cStatistic for statistic cStatistic is the base class for all statistical data collection classes. cStatistic itself adds no data members or algorithms to cOwnedObject, it only defines virtual functions that will be redefined in descendants. No instance of cStatistic can be created cStdDev - Statistics class to collect min, max, mean, and standard deviation cWeightedStdDev is similar to cStdDev, but accepts weighted observations. cWeightedStdDev can be used for example to calculate time average. It is the only weighted statistics class. cDensityEstBase - Distribution estimation Wireless and Broadband Network Laboratory (WBNLAB) 2018/12/29

24 Analyzing Simulation Results
Statistics in OMNeT++ Statistic and result collection classes cStdDev, cWeightedStdDev, LongHistgoram, cDoubleHistogram … Refer to cStatistic Class Reference in OMNeT++ API Collects statistic data cStatistic::collect() Records the statistics into the scalar file cStatistic::record() Mostly, we can create a private member variable with cStdDev for statistic Min, max, mean, and standard deviation cStatistic is the base class for all statistical data collection classes. cStatistic itself adds no data members or algorithms to cOwnedObject, it only defines virtual functions that will be redefined in descendants. No instance of cStatistic can be created cStdDev - Statistics class to collect min, max, mean, and standard deviation cWeightedStdDev is similar to cStdDev, but accepts weighted observations. cWeightedStdDev can be used for example to calculate time average. It is the only weighted statistics class. cDensityEstBase - Distribution estimation Wireless and Broadband Network Laboratory (WBNLAB) 2018/12/29

25 Analyzing Simulation Results
Statistics in OMNeT++ cStatistic is the base class for all statistical data collection classes. cStatistic itself adds no data members or algorithms to cOwnedObject, it only defines virtual functions that will be redefined in descendants. No instance of cStatistic can be created cStdDev - Statistics class to collect min, max, mean, and standard deviation cWeightedStdDev is similar to cStdDev, but accepts weighted observations. cWeightedStdDev can be used for example to calculate time average. It is the only weighted statistics class. cDensityEstBase - Distribution estimation Wireless and Broadband Network Laboratory (WBNLAB) 2018/12/29

26 Analyzing Simulation Results
Analysis file .anf files Reproducible recipe for finding results from raw data (vector or scalar) Creating analysis file File | new | Analysis File or Double click on the result files in the Project Explore View Analysis Editor Selecting input files browsing input filter expressions Datasets Datasets describe a set of input data, the processing applied to them and the charts (reproducible recipe) Wireless and Broadband Network Laboratory (WBNLAB) 2018/12/29

27 Analyzing Simulation Results
Editing datasets add new dataset Filter expressions Add button (specify filter pattern by string) Browse data (specify filter pattern by GUI) Reproducible recipe Specifying Run ID – * Chart types Bar chart Line chart Histogram chart Wireless and Broadband Network Laboratory (WBNLAB) 2018/12/29

28 Analyzing Simulation Results
Example Scenario – tictoc with 5 nodes Recording simulation results Hop count – Output Vector file Use cOutVector object, record() function when handleMessage() #received and #sent messages – Output Scalar file Use recordScalar() function when finish() Mean hop count – Output Scalar file Use cStdDev object, setName(), collect(), and record() functions Wireless and Broadband Network Laboratory (WBNLAB) 2018/12/29

29 Summary Wireless and Broadband Network Laboratory (WBNLAB) 2018/12/29

30 SimpleTictoc – tictoc with 2 nodes
A “network“ that consists of two nodes, one of the nodes will create a packet, and the two nodes will keep passing the same packet back and forth Wireless and Broadband Network Laboratory (WBNLAB) 2018/12/29

31 TicToc with five nodes One of the nodes generates a message,
The others keep tossing it around in random directions Wireless and Broadband Network Laboratory (WBNLAB) 2018/12/29

32 FYI Simulation models http://www.omnetpp.org/models INET Framework –
INET Framework contains models for IP, TCP, UDP, PPP, Ethernet, and other protocols INETMANET (new) – Ad hoc routing protocol implementations for the INET Framework Mobility Framework – Supports simulation of wireless and mobile network Etc. Wireless and Broadband Network Laboratory (WBNLAB) 2018/12/29

33 FYI Additional useful tools Blackboard object Gnuplot
Plot data with flexible format Shell script or batch file Run multiple scenarios sequentially Blackboard object Statistic Debugging Wireless and Broadband Network Laboratory (WBNLAB) 2018/12/29


Download ppt "Introduction to OMNeT++"

Similar presentations


Ads by Google