1 Introduction
2 Overview
3 The NED Language
4 Simple Modules
5 Messages
6 The Simulation Library
7 Building Simulation Programs
8 Configuring Simulations
9 Running Simulations
10 Network Graphics And Animation
11 Result Recording and Analysis
12 Eventlog
13 Documenting NED and Messages
14 Parallel Distributed Simulation
15 Plug-in Extensions
16 Embedding the Simulation Kernel
17 Appendix: NED Reference
18 Appendix: NED Language Grammar
19 Appendix: NED XML Binding
20 Appendix: NED Functions
21 Appendix: Message Definitions Grammar
22 Appendix: Display String Tags
23 Appendix: Configuration Options
24 Appendix: Result File Formats
25 Appendix: Eventlog File Format
1 Introduction
1.1 What Is OMNeT++?
1.2 Organization of This Manual
2 Overview
2.1 Modeling Concepts
2.1.1 Hierarchical Modules
2.1.2 Module Types
2.1.3 Messages, Gates, Links
2.1.4 Modeling of Packet Transmissions
2.1.5 Parameters
2.1.6 Topology Description Method
2.2 Programming the Algorithms
2.3 Using OMNeT++
2.3.1 Building and Running Simulations
2.3.2 What Is in the Distribution
3 The NED Language
3.1 NED Overview
3.2 NED Quickstart
3.2.1 The Network
3.2.2 Introducing a Channel
3.2.3 The App, Routing, and Queue Simple Modules
3.2.4 The Node Compound Module
3.2.5 Putting It Together
3.3 Simple Modules
3.4 Compound Modules
3.5 Channels
3.6 Parameters
3.7 Gates
3.8 Submodules
3.9 Connections
3.10 Multiple Connections
3.10.1 Connection Patterns
3.11 Submodule Type as Parameter
3.12 Properties (Metadata Annotations)
3.13 Inheritance
3.14 Packages
4 Simple Modules
4.1 Simulation Concepts
4.1.1 Discrete Event Simulation
4.1.2 The Event Loop
4.1.3 Events and Event Execution Order in OMNeT++
4.1.4 Simulation Time
4.1.5 FES Implementation
4.2 Components, Simple Modules, Channels
4.3 Defining Simple Module Types
4.3.1 Overview
4.3.2 Constructor
4.3.3 Initialization and Finalization
4.4 Adding Functionality to cSimpleModule
4.4.1 handleMessage()
4.4.2 activity()
4.4.3 How to Avoid Global Variables
4.4.4 Reusing Module Code via Subclassing
4.5 Accessing Module Parameters
4.5.1 Volatile and Non-Volatile Parameters
4.5.2 Changing a Parameter's Value
4.5.3 Further cPar Methods
4.5.4 Emulating Parameter Arrays
4.5.5 handleParameterChange()
4.6 Accessing Gates and Connections
4.6.1 Gate Objects
4.6.2 Connections
4.6.3 The Connection's Channel
4.7 Sending and Receiving Messages
4.7.1 Self-Messages
4.7.2 Sending Messages
4.7.3 Broadcasts and Retransmissions
4.7.4 Delayed Sending
4.7.5 Direct Message Sending
4.7.6 Packet Transmissions
4.7.7 Receiving Messages with activity()
4.8 Channels
4.8.1 Overview
4.8.2 The Channel API
4.8.3 Channel Examples
4.9 Stopping the Simulation
4.9.1 Normal Termination
4.9.2 Raising Errors
4.10 Finite State Machines
4.11 Navigating the Module Hierarchy
4.12 Direct Method Calls Between Modules
4.13 Dynamic Module Creation
4.13.1 When Do You Need Dynamic Module Creation
4.13.2 Overview
4.13.3 Creating Modules
4.13.4 Deleting Modules
4.13.5 Module Deletion and finish()
4.13.6 Creating Connections
4.13.7 Removing Connections
4.14 Signals
4.14.1 Design Considerations and Rationale
4.14.2 The Signals Mechanism
4.14.3 Listening to Model Changes
4.14.4 Exposing Statistics as Signals
5 Messages
5.1 Messages and Packets
5.1.1 The cMessage and cPacket Classes
5.1.2 Self-Messages
5.1.3 Modelling Packets
5.1.4 Encapsulation
5.1.5 Attaching Parameters and Objects
5.2 Message Definitions
5.2.1 Introduction
5.2.2 Declaring Enums
5.2.3 Message Declarations
5.2.4 Inheritance, Composition
5.2.5 Using Existing C++ Types
5.2.6 Customizing the Generated Class
5.2.7 Using STL in Message Classes
5.2.8 Summary
5.2.9 What Else Is There in the Generated Code?
6 The Simulation Library
6.1 Class Library Conventions
6.1.1 Base Class
6.1.2 Setting and Getting Attributes
6.1.3 getClassName()
6.1.4 Object Names
6.1.5 Object Full Name and Full Path
6.1.6 Copying and Duplicating Objects
6.1.7 Iterators
6.1.8 Error Handling
6.2 Logging from Modules
6.3 Simulation Time Conversion
6.4 Generating Random Numbers
6.4.1 Random Number Generators
6.4.2 Random Number Streams, RNG Mapping
6.4.3 Accessing The RNGs
6.4.4 Random Variates
6.4.5 Random Numbers from Histograms
6.5 Container Classes
6.5.1 Queue class: cQueue
6.5.2 Expandable Array: cArray
6.6 Routing Support: cTopology
6.6.1 Overview
6.6.2 Basic Usage
6.6.3 Shortest Paths
6.7 Statistics and Distribution Estimation
6.7.1 cStatistic and Descendants
6.7.2 Distribution Estimation
6.7.3 The k-split Algorithm
6.7.4 Transient Detection and Result Accuracy
6.8 Recording Simulation Results
6.8.1 Output Vectors: cOutVector
6.8.2 Output Scalars
6.9 Watches and Snapshots
6.9.1 Basic Watches
6.9.2 Read-write Watches
6.9.3 Structured Watches
6.9.4 STL Watches
6.9.5 Snapshots
6.9.6 Getting Coroutine Stack Usage
6.10 Deriving New Classes
6.10.1 cOwnedObject or Not?
6.10.2 cOwnedObject Virtual Methods
6.10.3 Class Registration
6.10.4 Details
6.11 Object Ownership Management
6.11.1 The Ownership Tree
6.11.2 Managing Ownership
7 Building Simulation Programs
7.1 Overview
7.2 Using gcc
7.2.1 The opp_makemake Tool
7.2.2 Basic Use
7.2.3 Debug and Release Builds
7.2.4 Using External C/C++ Libraries
7.2.5 Building Directory Trees
7.2.6 Automatic Include Dirs
7.2.7 Dependency Handling
7.2.8 Out-of-Directory Build
7.2.9 Building Shared and Static Libraries
7.2.10 Recursive Builds
7.2.11 Customizing the Makefile
7.2.12 Projects with Multiple Source Trees
7.2.13 A Multi-Directory Example
8 Configuring Simulations
8.1 The Configuration File
8.1.1 An Example
8.1.2 File Syntax
8.1.3 File Inclusion
8.2 Sections
8.2.1 The [General] Section
8.2.2 Named Configurations
8.2.3 Section Inheritance
8.3 Assigning Module Parameters
8.3.1 Using Wildcard Patterns
8.3.2 Using the Default Values
8.4 Parameter Studies
8.4.1 Basic Use
8.4.2 Named Iteration Variables
8.4.3 Repeating Runs with Different Seeds
8.4.4 Experiment-Measurement-Replication
8.5 Configuring the Random Number Generators
8.5.1 Number of RNGs
8.5.2 RNG Choice
8.5.3 RNG Mapping
8.5.4 Automatic Seed Selection
8.5.5 Manual Seed Configuration
9 Running Simulations
9.1 Introduction
9.1.1 Running a Simulation Executable
9.1.2 Running a Shared Library
9.1.3 Controlling the Run
9.2 Cmdenv: the Command-Line Interface
9.2.1 Example Run
9.2.2 Command-Line Options
9.2.3 Cmdenv Ini File Options
9.2.4 Interpreting Cmdenv Output
9.3 Tkenv: the Graphical User Interface
9.3.1 Command-Line and Configuration Options
9.4 Batch Execution
9.4.1 Using Cmdenv
9.4.2 Using Shell Scripts
9.4.3 Using opp_runall
9.5 Akaroa Support: Multiple Replications in Parallel
9.5.1 Introduction
9.5.2 What Is Akaroa
9.5.3 Using Akaroa with OMNeT++
9.6 Troubleshooting
9.6.1 Unrecognized Configuration Option
9.6.2 Stack Problems
9.6.3 Memory Leaks and Crashes
9.6.4 Simulation Executes Slowly
10 Network Graphics And Animation
10.1 Display Strings
10.1.1 Display String Syntax
10.1.2 Display String Placement
10.1.3 Display String Inheritance
10.1.4 Display String Tags Used in Submodule Context
10.1.5 Display String Tags Used in Module Background Context
10.1.6 Connection Display Strings
10.1.7 Message Display Strings
10.2 Parameter Substitution
10.3 Colors
10.3.1 Color Names
10.3.2 Icon Colorization
10.4 Icons
10.4.1 The Image Path
10.4.2 Categorized Icons
10.4.3 Icon Size
10.5 Layouting
10.6 Enhancing Animation
10.6.1 Changing Display Strings at Runtime
10.6.2 Bubbles
11 Result Recording and Analysis
11.1 Result Recording
11.1.1 Using the C++ API
11.1.2 Using Declared Statistics and Signals
11.2 Configuring Result Collection
11.2.1 Result File Names
11.2.2 Turning Off Scalar or Vector Recording Globally
11.2.3 Warm-up Period
11.2.4 Configuring Scalar Results
11.2.5 Configuring Output Vectors
11.2.6 Saving Parameters as Scalars
11.2.7 Recording Precision
11.3 Overview of the Result File Formats
11.3.1 Output Vector Files
11.3.2 Scalar Result Files
11.4 The Analysis Tool in the Simulation IDE
11.5 Scave Tool
11.5.1 The filter Command
11.5.2 The index Command
11.5.3 The summary Command
11.6 Alternative Statistical Analysis and Plotting Tools
11.6.1 Spreadsheet Programs
11.6.2 GNU R
11.6.3 MATLAB or Octave
11.6.4 NumPy and MatPlotLib
11.6.5 ROOT
11.6.6 Gnuplot
11.6.7 Grace
12 Eventlog
12.1 Introduction
12.2 Configuration
12.2.1 File Name
12.2.2 Recording Intervals
12.2.3 Recording Modules
12.2.4 Recording Message Data
12.3 Eventlog Tool
12.3.1 Filter
12.3.2 Echo
13 Documenting NED and Messages
13.1 Overview
13.2 Documentation Comments
13.2.1 Private Comments
13.2.2 More on Comment Placement
13.3 Text Layout and Formatting
13.3.1 Paragraphs and Lists
13.3.2 Special Tags
13.3.3 Text Formatting Using HTML
13.3.4 Escaping HTML Tags
13.4 Customizing and Adding Pages
13.4.1 Adding a Custom Title Page
13.4.2 Adding Extra Pages
13.4.3 Incorporating Externally Created Pages
14 Parallel Distributed Simulation
14.1 Introduction to Parallel Discrete Event Simulation
14.2 Assessing Available Parallelism in a Simulation Model
14.3 Parallel Distributed Simulation Support in OMNeT++
14.3.1 Overview
14.3.2 Parallel Simulation Example
14.3.3 Placeholder Modules, Proxy Gates
14.3.4 Configuration
14.3.5 Design of PDES Support in OMNeT++
15 Plug-in Extensions
15.1 Overview
15.2 Plug-in Descriptions
15.2.1 Defining a New Random Number Generator
15.2.2 Defining a New Scheduler
15.2.3 Defining a New Configuration Provider
15.2.4 Defining a New Output Scalar Manager
15.2.5 Defining a New Output Vector Manager
15.2.6 Defining a New Snapshot Manager
15.3 Accessing the Configuration
15.3.1 Defining New Configuration Options
15.3.2 Reading Values from the Configuration
15.4 Implementing a New User Interface
16 Embedding the Simulation Kernel
16.1 Architecture
16.2 Embedding the OMNeT++ Simulation Kernel
16.2.1 The main() Function
16.2.2 The simulate() Function
16.2.3 Providing an Environment Object
16.2.4 Providing a Configuration Object
16.2.5 Loading NED Files
16.2.6 How to Eliminate NED Files
16.2.7 Assigning Module Parameters
16.2.8 Extracting Statistics from the Model
16.2.9 The Simulation Loop
16.2.10 Multiple, Coexisting Simulations
16.2.11 Installing a Custom Scheduler
16.2.12 Multi-Threaded Programs
17 Appendix: NED Reference
17.1 Syntax
17.1.1 NED File Extension
17.1.2 NED File Encoding
17.1.3 Reserved Words
17.1.4 Identifiers
17.1.5 Case Sensitivity
17.1.6 Literals
17.1.7 Comments
17.1.8 Grammar
17.2 Built-in Definitions
17.3 Packages
17.3.1 Package Declaration
17.3.2 Directory Structure, package.ned
17.4 Components
17.4.1 Simple Modules
17.4.2 Compound Modules
17.4.3 Networks
17.4.4 Channels
17.4.5 Module Interfaces
17.4.6 Channel Interfaces
17.4.7 Resolving the Implementation C++ Class
17.4.8 Properties
17.4.9 Parameters
17.4.10 Gates
17.4.11 Submodules
17.4.12 Connections
17.4.13 Inner Types
17.4.14 Name Uniqueness
17.4.15 Type Name Resolution
17.4.16 Implementing an Interface
17.4.17 Inheritance
17.4.18 Network Build Order
17.5 Expressions
17.5.1 Operators
17.5.2 Referencing Parameters and Loop Variables
17.5.3 The index Operator
17.5.4 The sizeof() Operator
17.5.5 The xmldoc() Operator
17.5.6 Functions
17.5.7 Units of Measurement
18 Appendix: NED Language Grammar
19 Appendix: NED XML Binding
20 Appendix: NED Functions
21 Appendix: Message Definitions Grammar
22 Appendix: Display String Tags
22.1 Module and Connection Display String Tags
22.2 Message Display String Tags
23 Appendix: Configuration Options
23.1 Configuration Options
23.2 Predefined Configuration Variables
24 Appendix: Result File Formats
24.1 Version
24.2 Run Declaration
24.3 Attributes
24.4 Module Parameters
24.5 Scalar Data
24.6 Vector Declaration
24.7 Vector Data
24.8 Index Header
24.9 Index Data
24.10 Statistics Object
24.11 Field
24.12 Histogram Bin
25 Appendix: Eventlog File Format
25.1 Supported Entry Types and Their Attributes
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:
OMNeT++ itself is not a simulator of anything concrete, but rather provides infrastructure and tools for writing simulations. One of the fundamental ingredients of this infrastructure is a component architecture for simulation models. Models are assembled from reusable components termed modules. Well-written modules are truly reusable, and can be combined in various ways like LEGO blocks.
Modules can be connected with each other via gates (other systems would call them ports), and combined to form compound modules. The depth of module nesting is not limited. Modules communicate through message passing, where messages may carry arbitrary data structures. Modules can pass messages along predefined paths via gates and connections, or directly to their destination; the latter is useful for wireless simulations, for example. Modules may have parameters that can be used to customize module behavior and/or to parameterize the model's topology. Modules at the lowest level of the module hierarchy are called simple modules, and they encapsulate model behavior. Simple modules are programmed in C++, and make use of the simulation library.
OMNeT++ simulations can be run under various user interfaces. Graphical, animating user interfaces are highly useful for demonstration and debugging purposes, and command-line user interfaces are best for batch execution.
The simulator as well as user interfaces and tools are highly portable. They are tested on the most common operating systems (Linux, Mac OS/X, Windows), and they can be compiled out of the box or after trivial modifications on most Unix-like operating systems.
OMNeT++ also supports parallel distributed simulation. OMNeT++ can use several mechanisms for communication between partitions of a parallel distributed simulation, for example MPI or named pipes. The parallel simulation algorithm can easily be extended, or new ones can be plugged in. Models do not need any special instrumentation to be run in parallel -- it is just a matter of configuration. OMNeT++ can even be used for classroom presentation of parallel simulation algorithms, because simulations can be run in parallel even under the GUI that provides detailed feedback on what is going on.
OMNEST is the commercially supported version of OMNeT++. OMNeT++ is free only for academic and non-profit use; for commercial purposes, one needs to obtain OMNEST licenses from Simulcraft Inc.
The manual is organized as follows: