introduction to simulation with omnet++ josé daniel garcía sánchez arcos group – university...
TRANSCRIPT
INTRODUCTION TO SIMULATION WITH OMNET++
José Daniel García SánchezARCOS Group – University Carlos III of Madrid
2
Contents
The ARCOS Group. Expand motivation. Expand design. Expand evaluation. Conclusions. Ongoing Work.
July 2007 - University of Modena
The Expand Parallel File SystemJosé Daniel García Sánchez – ARCOS Group – University Carlos III of
Madrid
3
University Carlos III of Madrid Founded in 1989
Three faculties: Faculty of Social
Sciences and Law. Faculty of
Humanities, Documentation and Communication.
Higher Technical School. July 2007 - University of
Modena
The Expand Parallel File SystemJosé Daniel García Sánchez – ARCOS Group – University Carlos III of
Madrid
4
The ARCOS Group
The Computer Architecture, Communications and Systems Group is part of the Department of Computer Science.
20 full time members 9 PhD’s (2 full professors + 4 associate
professors + 3 visiting professors). 11 PhD students
July 2007 - University of Modena
The Expand Parallel File SystemJosé Daniel García Sánchez – ARCOS Group – University Carlos III of
Madrid
5
Research lines
Data management on Grid environments.
Parallel file systems. Optimization of irregular applications. OS for Wireless Sensor Networks. Real-time systems.
July 2007 - University of Modena
The Expand Parallel File SystemJosé Daniel García Sánchez – ARCOS Group – University Carlos III of
Madrid
6
Contents
The ARCOS Group. OMNET++ features. Simulation model building. Additional features of the simulation
kernel. INET Framework.
Introduction to simulation with OMNET++ José Daniel García Sánchez – ARCOS Group – University Carlos III of
Madrid
July 2007 - University of Modena
7
What is OMNET++?
A discrete event simulation environment. Mainly focused in communication networks. Runs on Linux and Windows. C++ based. Free for academic and non-profit use. GUI support. Supports parallel execution (MPI based). Several component add-on libraries
available.
Introduction to simulation with OMNET++ José Daniel García Sánchez – ARCOS Group – University Carlos III of
Madrid
July 2007 - University of Modena
8
Available off-the-shelf models TCP/IP.
IP. TPC. UDP PPP. …
Network protocols Ethernet. 802.11. FDDI. Token Ring.
Peer-to-peer. Sensor networks.
Introduction to simulation with OMNET++ José Daniel García Sánchez – ARCOS Group – University Carlos III of
Madrid
July 2007 - University of Modena
Important issues in a discrete event simulation environment
9
Pseudorandom generators. Flexibility. Programming model. Model management. Support for hierarchical models. Debugging and tracing. Documentation. Large scale simulation. Parallel simulation. Experiment specification.
Introduction to simulation with OMNET++ José Daniel García Sánchez – ARCOS Group – University Carlos III of
Madrid
July 2007 - University of Modena
10
Randomness
Several random number generators Including Mersenne-Twister. Easy to plug-in custom generators.
Mechanism for generating most random variates. 14 continuous distributions. 6 discrete distributions. Very easy to define your own distributions. Capability to generate a distribution from a
sample.Introduction to simulation with OMNET++
José Daniel García Sánchez – ARCOS Group – University Carlos III of Madrid
July 2007 - University of Modena
11
Flexibility
Core framework for discrete event simulation. Different add-on for specific purposes.
Fully implemented in C++.
Functionality added by deriving classes following specified rules.
Introduction to simulation with OMNET++ José Daniel García Sánchez – ARCOS Group – University Carlos III of
Madrid
July 2007 - University of Modena
12
Programming model
Key elements: Topology: Describes relationship among
elements. Behavior: Describes how a node behaves.
Topology Behavior NED Language
Describes links among nodes. Describes composition
model. May be text edited or GUI.
Possibility to create topology at run-time.
C++ Code automatically generated.
Only methods describing behavior are needed to be redefined.
Introduction to simulation with OMNET++ José Daniel García Sánchez – ARCOS Group – University Carlos III of
Madrid
July 2007 - University of Modena
13
Model management
Clear separation among simulation kernel and developed models.
Easiness of packaging developed modules for reuse.
No need for patching the simulation kernel to install a model.
Build models and combine like LEGO
blocks
Introduction to simulation with OMNET++ José Daniel García Sánchez – ARCOS Group – University Carlos III of
Madrid
July 2007 - University of Modena
14
Hierarchical modeling
Modules are self-contained and reusable. Compound models may be assembled
from simpler modules without no coding effort.
Introduction to simulation with OMNET++ José Daniel García Sánchez – ARCOS Group – University Carlos III of
Madrid
July 2007 - University of Modena
15
Debugging and tracking
Simulations may be run in two modes: Command line: Minimum I/O, high
performance. Interactive GUI: Tcl/Tk windowing, allows
view what’s happening and modify parameters at run-time.
Additional support for tracing.
Introduction to simulation with OMNET++ José Daniel García Sánchez – ARCOS Group – University Carlos III of
Madrid
July 2007 - University of Modena
16
Documentation
Well structured documentation. Well written and complete user’s manual.
247 pages. Well documented (doxygen) API.
Documentation system for models is doxygen based and connects very well model documentation and API documentation.
Introduction to simulation with OMNET++ José Daniel García Sánchez – ARCOS Group – University Carlos III of
Madrid
July 2007 - University of Modena
The documentation is well organized, automatically generated from source code and easy to browse.
Documentation17
Introduction to simulation with OMNET++ José Daniel García Sánchez – ARCOS Group – University Carlos III of
Madrid
July 2007 - University of Modena
Large scale simulation18
Only limiting known factor is available virtual memory.
Very good use of memory.
If you need more, go for parallel simulation.
Introduction to simulation with OMNET++ José Daniel García Sánchez – ARCOS Group – University Carlos III of
Madrid
July 2007 - University of Modena
19
Support for parallel simulation Run one realization of a simulation
experiment in a cluster. No code modification needed!
Just modify configuration files. Communication is MPI based.
Named pipes and shared files also available.
Conservative approach to parallel simulation.
Introduction to simulation with OMNET++ José Daniel García Sánchez – ARCOS Group – University Carlos III of
Madrid
July 2007 - University of Modena
20
Experiment specification
Experiment structure is defined via a topology file.
Experiment parameters are specified via configuration files.
Integrated data collection support.
Introduction to simulation with OMNET++ José Daniel García Sánchez – ARCOS Group – University Carlos III of
Madrid
July 2007 - University of Modena
21
Contents
The ARCOS Group. OMNET++ features. Simulation model building. Additional features of the simulation
kernel. INET Framework.
Introduction to simulation with OMNET++ José Daniel García Sánchez – ARCOS Group – University Carlos III of
Madrid
July 2007 - University of Modena
22
Simulation Model building
for (int i=0;i<10;i++) {}...
[General]network=test_disk
[Parameters]...
Model structu
re
Add behavior
Set up parameters
Compile
Run
Analyze
Introduction to simulation with OMNET++ José Daniel García Sánchez – ARCOS Group – University Carlos III of
Madrid
July 2007 - University of Modena
23
Build process
Network description
nedtool compiler
Generated C++ code
Module behavior C++
code
C++ compiler C++ compiler
Simulation
kernel libraries
User interfac
e libraries
Linker
Simulation
programIntroduction to simulation with OMNET++
José Daniel García Sánchez – ARCOS Group – University Carlos III of Madrid
July 2007 - University of Modena
24
Contents
The ARCOS Group. OMNET++ features. Simulation model building.
M/M/1 Example. Additional features of the simulation
kernel. INET Framework.
Introduction to simulation with OMNET++ José Daniel García Sánchez – ARCOS Group – University Carlos III of
Madrid
July 2007 - University of Modena
25
Example
To show capabilities of OMNET++ basic features.
Evaluate M/M/1 Queue System.
RequestGenerator Server
messages
Introduction to simulation with OMNET++ José Daniel García Sánchez – ARCOS Group – University Carlos III of
Madrid
July 2007 - University of Modena
26
Step 1: Define the modules
Two simple modules RequestGenerator. Server.
Parameters: Set up by an
enclosing module or at run-time.
interEventTime
RequestGenerator
Gate
Gate
serviceTime
Server
outpoint
inpoint
Introduction to simulation with OMNET++ José Daniel García Sánchez – ARCOS Group – University Carlos III of
Madrid
July 2007 - University of Modena
27
Step 1: Compound module
interEventTime
serviceTime
RequestGenerator Server
outpointinpoint
Connection
SingleServer
Needs to be instantiatedas a network
Introduction to simulation with OMNET++ José Daniel García Sánchez – ARCOS Group – University Carlos III of
Madrid
July 2007 - University of Modena
28
Step 1: Topology definition
The whole topology definition is expressed in the specific purpose NED language. Only structural description. Very simple. GUI for NED editing (I prefer text editing). C++ code automatically generated from
NED.
Introduction to simulation with OMNET++ José Daniel García Sánchez – ARCOS Group – University Carlos III of
Madrid
July 2007 - University of Modena
29
Step 2: Add Behavior
Each simple module needs a C++ class implementing its behavior. Follow user’s manual guidelines. Few methods needed.
No C++ coding for compound modules.
Introduction to simulation with OMNET++ José Daniel García Sánchez – ARCOS Group – University Carlos III of
Madrid
July 2007 - University of Modena
30
Step 2: Writing the code
For each simple module Write a class derived from cSimpleModule.
Special rules: Two stage creation: Constructor +
initialize(). Two stage destruction: finish() + Destructor. Message handling:
Synchronous (More memory consuming, easy to understand).
Asynchronous (Event based, more efficient).Introduction to simulation with OMNET++
José Daniel García Sánchez – ARCOS Group – University Carlos III of Madrid
July 2007 - University of Modena
31
Send messages. Wait
interEventTime between two sending.
Use a timer to schedule next sending.
Each time a request arrives process or enqueue.
Wait serviceTime for processing by using a timer.
Record statistics of service time.
RequestGenerator Server
July 2007 - University of Modena
Step 2: Writing the code
Introduction to simulation with OMNET++ José Daniel García Sánchez – ARCOS Group – University Carlos III of
Madrid
Step 2: Coding effort
Ned files: 35 lines RequestGenerator
.ned: 6 Server.ned: 6 SingleServer.ned:
23
C++ code: 152 RequestGenerator
.h: 23 RequestGenerator
.cc: 33 Server.h: 31 Server.cc: 65
32
Coding 187 lines
Introduction to simulation with OMNET++ José Daniel García Sánchez – ARCOS Group – University Carlos III of
Madrid
July 2007 - University of Modena
Step 3: Writing a configuration file
33
Most things can be set-up via an ini file Changing things without recompiling. Very simple syntax.
Some things: Model to be run. Time limitation. Random number generator. Parameters.
Introduction to simulation with OMNET++ José Daniel García Sánchez – ARCOS Group – University Carlos III of
Madrid
July 2007 - University of Modena
34
Step 4: Build
Utilities for automatically generating makefiles from existing sources.
You can build a command-line or a GUI-based binary.
Introduction to simulation with OMNET++ José Daniel García Sánchez – ARCOS Group – University Carlos III of
Madrid
July 2007 - University of Modena
35
Step 5: Running the simulation Example 1: constantParams.ini
Example 2: exponentialParams.ini
Example 3: batchRuns.ini
Introduction to simulation with OMNET++ José Daniel García Sánchez – ARCOS Group – University Carlos III of
Madrid
July 2007 - University of Modena
36
Contents
The ARCOS Group. OMNET++ features. Simulation model building.
Adding channels and hierarchical modeling.
Additional features of the simulation kernel.
INET Framework.
Introduction to simulation with OMNET++ José Daniel García Sánchez – ARCOS Group – University Carlos III of
Madrid
July 2007 - University of Modena
37
Channels
It is possible to define a channel and assign it to a link.
Channel properties: Delay: Propagation delay in seconds. Error: Bit error rate. Datarate: Bandwidth used to calculating
transmission time of a message.
A length must be assigned to the channel.Introduction to simulation with OMNET++
José Daniel García Sánchez – ARCOS Group – University Carlos III of Madrid
July 2007 - University of Modena
38
Example: N Clients to M Servers
ClientPopulation ServerClusterChannel
RequestGenerator
ClientSwitch
RequestGenerator
…ServerSwitch
Server
Server
…
Introduction to simulation with OMNET++ José Daniel García Sánchez – ARCOS Group – University Carlos III of
Madrid
July 2007 - University of Modena
39
Building the simulation
Step 1: Write the new ned files. Step 2: Write/modify code. Step 3: Write configuration file
Set up number of clients and servers.
Step 4: Build Step 5: Run
A simulation with 100000 clients and 40 servers run on a laptop.
Introduction to simulation with OMNET++ José Daniel García Sánchez – ARCOS Group – University Carlos III of
Madrid
July 2007 - University of Modena
40
Contents
The ARCOS Group. OMNET++ features. Simulation model building. Additional features of the
simulation kernel. INET Framework.
Introduction to simulation with OMNET++ José Daniel García Sánchez – ARCOS Group – University Carlos III of
Madrid
July 2007 - University of Modena
41
Messages
Messages are sent among modules.
Attributes: Name: String used in the GUI. Kind: Numeric value representing
information type. Length: Number of bits used to compute
transmission times. Sending and arrival times. Source and destination moduel and gate.
Introduction to simulation with OMNET++ José Daniel García Sánchez – ARCOS Group – University Carlos III of
Madrid
July 2007 - University of Modena
42
Message definition language In many cases a message needs to carry
additional information. The structure of the message may be
defined in an msg file and then automatically generate C++.
Introduction to simulation with OMNET++ José Daniel García Sánchez – ARCOS Group – University Carlos III of
Madrid
July 2007 - University of Modena
Collecting data and statistics Several classes to
collect data and compute statistics. Basic statistic
estimation. Weigthed statistic. Histograms. Quantiles computation
without storing data.
Transient and accuracy detection at run-time.
Recording scalars at the end of the simulation.
Recording vector of data during the simulation.
Simple view Scalars Plove
43
Introduction to simulation with OMNET++ José Daniel García Sánchez – ARCOS Group – University Carlos III of
Madrid
July 2007 - University of Modena
Debugging: Watches and snapshots
44
During run-time it is possible to watch values from C++ variables or structures (even modify).
Easy to use Just a macro line.
Snapshots allow dumping all the objects to a file for debugging the simulation.
Introduction to simulation with OMNET++ José Daniel García Sánchez – ARCOS Group – University Carlos III of
Madrid
July 2007 - University of Modena
45
Parallel and distributed simulation Allows running a single realization of a
simulation experiment on a set of machines.
No programming needed. Just configuration.
Conservative synchronization among computing nodes.
Introduction to simulation with OMNET++ José Daniel García Sánchez – ARCOS Group – University Carlos III of
Madrid
July 2007 - University of Modena
46
Parallel Configuration
All the configuration for parallel execution done in the ini file.
Allocating modules Set in the ini file the partition-id property.
General configuration: Activate the parallel execution. Select the communication class: MPI, files, named
pipes Select the synchronization class: Null message
protocolIntroduction to simulation with OMNET++
José Daniel García Sánchez – ARCOS Group – University Carlos III of Madrid
July 2007 - University of Modena
47
Contents
The ARCOS Group. OMNET++ features. Simulation model building. Additional features of the simulation
kernel. INET Framework.
Introduction to simulation with OMNET++ José Daniel García Sánchez – ARCOS Group – University Carlos III of
Madrid
July 2007 - University of Modena
48
INET Framework
A library of OMNET++ modules for building network simulations.
Layers: Applications: Protocol specific applications (e.g.
Telenet) Mobility: Motion patterns of mobile objects Nodes: Nodes in the network (e.g. Router,
StandardHost) Transport: Transport protocols (e.g. TCP) Network: Network protocols (e.g. IPv4) NetworkInterfaces (e.g. Ethernet)
Introduction to simulation with OMNET++ José Daniel García Sánchez – ARCOS Group – University Carlos III of
Madrid
July 2007 - University of Modena
49
Network interfaces
Ethernet PPP IEEE 802.11
Introduction to simulation with OMNET++ José Daniel García Sánchez – ARCOS Group – University Carlos III of
Madrid
July 2007 - University of Modena
50
Network
Protocols ARP. ICMP (v4 & v6). IP (v4 & v6). LDP. MLPS. OSPF Routing. RSVP.
Other functionality Automatic network configuration.
Introduction to simulation with OMNET++ José Daniel García Sánchez – ARCOS Group – University Carlos III of
Madrid
July 2007 - University of Modena
51
Transport
TCP UDP RTP
Introduction to simulation with OMNET++ José Daniel García Sánchez – ARCOS Group – University Carlos III of
Madrid
July 2007 - University of Modena
52
Nodes
Contains nodes for different types of protocols. Mainly routers and hosts.
IPv4. IPv6. MPLS. Wireless. Ad-hoc networks.
Introduction to simulation with OMNET++ José Daniel García Sánchez – ARCOS Group – University Carlos III of
Madrid
July 2007 - University of Modena
53
Applications
Generic applications for Ethernet TCP UDP Ping.
Client and server applications.
Introduction to simulation with OMNET++ José Daniel García Sánchez – ARCOS Group – University Carlos III of
Madrid
July 2007 - University of Modena
54
Examples
Example 1: Web server Define the network topology. Configure parameters. Run.
Simple changes Number of clients. NAM tracing.
Introduction to simulation with OMNET++ José Daniel García Sánchez – ARCOS Group – University Carlos III of
Madrid
July 2007 - University of Modena