Omnet++ Introduction - unibo.itdonat/omnet.pdf · Outline What is Omnet++? How can I use it? How...
-
Upload
phamkhuong -
Category
Documents
-
view
217 -
download
2
Transcript of Omnet++ Introduction - unibo.itdonat/omnet.pdf · Outline What is Omnet++? How can I use it? How...
![Page 2: Omnet++ Introduction - unibo.itdonat/omnet.pdf · Outline What is Omnet++? How can I use it? How can it be useful for me? How much is it easy to develop in it? How much effort is](https://reader031.fdocuments.in/reader031/viewer/2022022009/5af18ace7f8b9a8c308ea626/html5/thumbnails/2.jpg)
Outline
● What is Omnet++?
● How can I use it?
● How can it be useful for me?
● How much is it easy to develop in it?
● How much effort is needed to learn it?
??
![Page 3: Omnet++ Introduction - unibo.itdonat/omnet.pdf · Outline What is Omnet++? How can I use it? How can it be useful for me? How much is it easy to develop in it? How much effort is](https://reader031.fdocuments.in/reader031/viewer/2022022009/5af18ace7f8b9a8c308ea626/html5/thumbnails/3.jpg)
What is Omnet++
● Omnet++ → discrete event simulator - C++– Hierarchical modules
– Modules communication
● A good set of developed modules● Free for academic use● OpenSource
– Download it from www.omnetpp.org
![Page 4: Omnet++ Introduction - unibo.itdonat/omnet.pdf · Outline What is Omnet++? How can I use it? How can it be useful for me? How much is it easy to develop in it? How much effort is](https://reader031.fdocuments.in/reader031/viewer/2022022009/5af18ace7f8b9a8c308ea626/html5/thumbnails/4.jpg)
Pros and Cons
● Pros– Easy
– Well structured
– Highly modular
– Could be used for different kind of simulations
● Cons– Young, not so much models available
![Page 5: Omnet++ Introduction - unibo.itdonat/omnet.pdf · Outline What is Omnet++? How can I use it? How can it be useful for me? How much is it easy to develop in it? How much effort is](https://reader031.fdocuments.in/reader031/viewer/2022022009/5af18ace7f8b9a8c308ea626/html5/thumbnails/5.jpg)
Main applications
● Modeling of network protocols
● Modeling of queuing networks
● Modeling of multiprocessor systems
● Performance evaluation of software systems
![Page 6: Omnet++ Introduction - unibo.itdonat/omnet.pdf · Outline What is Omnet++? How can I use it? How can it be useful for me? How much is it easy to develop in it? How much effort is](https://reader031.fdocuments.in/reader031/viewer/2022022009/5af18ace7f8b9a8c308ea626/html5/thumbnails/6.jpg)
Frameworks
![Page 7: Omnet++ Introduction - unibo.itdonat/omnet.pdf · Outline What is Omnet++? How can I use it? How can it be useful for me? How much is it easy to develop in it? How much effort is](https://reader031.fdocuments.in/reader031/viewer/2022022009/5af18ace7f8b9a8c308ea626/html5/thumbnails/7.jpg)
Main components
● Kernel Library
● Topology description (NED)
● Tkenv/Cmdenv
● Plotting and output analysis
![Page 8: Omnet++ Introduction - unibo.itdonat/omnet.pdf · Outline What is Omnet++? How can I use it? How can it be useful for me? How much is it easy to develop in it? How much effort is](https://reader031.fdocuments.in/reader031/viewer/2022022009/5af18ace7f8b9a8c308ea626/html5/thumbnails/8.jpg)
Omnet++ in 6 steps
Create a project
Define its location, its name, referenced projects
and so on
Create a project
Define its location, its name, referenced projects
and so on
![Page 9: Omnet++ Introduction - unibo.itdonat/omnet.pdf · Outline What is Omnet++? How can I use it? How can it be useful for me? How much is it easy to develop in it? How much effort is](https://reader031.fdocuments.in/reader031/viewer/2022022009/5af18ace7f8b9a8c308ea626/html5/thumbnails/9.jpg)
Create a project
Define its location, its name, referenced projects
and so on
Create a project
Define its location, its name, referenced projects
and so on
Omnet++ in 6 steps
Layout a module
Define its parameters, its gates, as well as interfaces and display setting
Layout a module
Define its parameters, its gates, as well as interfaces and display setting
![Page 10: Omnet++ Introduction - unibo.itdonat/omnet.pdf · Outline What is Omnet++? How can I use it? How can it be useful for me? How much is it easy to develop in it? How much effort is](https://reader031.fdocuments.in/reader031/viewer/2022022009/5af18ace7f8b9a8c308ea626/html5/thumbnails/10.jpg)
Create a project
Define its location, its name, referenced projects
and so on
Create a project
Define its location, its name, referenced projects
and so on
Omnet++ in 6 steps
Layout a module
Define its parameters, its gates, as well as interfaces and display setting
Layout a module
Define its parameters, its gates, as well as interfaces and display setting
Program it
Define the behavior, what happens when it is istantiated, when a message arrives,
when it has to send messages
Program it
Define the behavior, what happens when it is istantiated, when a message arrives,
when it has to send messages
![Page 11: Omnet++ Introduction - unibo.itdonat/omnet.pdf · Outline What is Omnet++? How can I use it? How can it be useful for me? How much is it easy to develop in it? How much effort is](https://reader031.fdocuments.in/reader031/viewer/2022022009/5af18ace7f8b9a8c308ea626/html5/thumbnails/11.jpg)
Create a project
Define its location, its name, referenced projects
and so on
Create a project
Define its location, its name, referenced projects
and so on
Omnet++ in 6 steps
Layout a module
Define its parameters, its gates, as well as interfaces and display setting
Layout a module
Define its parameters, its gates, as well as interfaces and display setting
Program it
Define the behavior, what happens when it is istantiated, when a message arrives,
when it has to send messages
Program it
Define the behavior, what happens when it is istantiated, when a message arrives,
when it has to send messages
Create a scenario
Define the number of modules, how they are connected, scenario parameters
Create a scenario
Define the number of modules, how they are connected, scenario parameters
![Page 12: Omnet++ Introduction - unibo.itdonat/omnet.pdf · Outline What is Omnet++? How can I use it? How can it be useful for me? How much is it easy to develop in it? How much effort is](https://reader031.fdocuments.in/reader031/viewer/2022022009/5af18ace7f8b9a8c308ea626/html5/thumbnails/12.jpg)
Create a project
Define its location, its name, referenced projects
and so on
Create a project
Define its location, its name, referenced projects
and so on
Omnet++ in 6 steps
Layout a module
Define its parameters, its gates, as well as interfaces and display setting
Layout a module
Define its parameters, its gates, as well as interfaces and display setting
Program it
Define the behavior, what happens when it is istantiated, when a message arrives,
when it has to send messages
Program it
Define the behavior, what happens when it is istantiated, when a message arrives,
when it has to send messages
Configure a simulation
Assign values to parameters, to or not to record charts,
maybe change the modules names
Configure a simulation
Assign values to parameters, to or not to record charts,
maybe change the modules names
Configure a simulation
Assign values to parameters, to or not to record charts,
maybe change the modules names
Configure a simulation
Assign values to parameters, to or not to record charts,
maybe change the modules names
![Page 13: Omnet++ Introduction - unibo.itdonat/omnet.pdf · Outline What is Omnet++? How can I use it? How can it be useful for me? How much is it easy to develop in it? How much effort is](https://reader031.fdocuments.in/reader031/viewer/2022022009/5af18ace7f8b9a8c308ea626/html5/thumbnails/13.jpg)
Create a project
Define its location, its name, referenced projects
and so on
Create a project
Define its location, its name, referenced projects
and so on
Omnet++ in 6 steps
Layout a module
Define its parameters, its gates, as well as interfaces and display setting
Layout a module
Define its parameters, its gates, as well as interfaces and display setting
Program it
Define the behavior, what happens when it is istantiated, when a message arrives,
when it has to send messages
Program it
Define the behavior, what happens when it is istantiated, when a message arrives,
when it has to send messages
Configure a simulation
Assign values to parameters, to or not to record charts,
maybe change the modules names
Configure a simulation
Assign values to parameters, to or not to record charts,
maybe change the modules names
Configure a simulation
Assign values to parameters, to or not to record charts,
maybe change the modules names
Configure a simulation
Assign values to parameters, to or not to record charts,
maybe change the modules names
Run it
Run the simulation, multiple times, analyze results, and maybego back to the second step
Run it
Run the simulation, multiple times, analyze results, and maybego back to the second step
![Page 14: Omnet++ Introduction - unibo.itdonat/omnet.pdf · Outline What is Omnet++? How can I use it? How can it be useful for me? How much is it easy to develop in it? How much effort is](https://reader031.fdocuments.in/reader031/viewer/2022022009/5af18ace7f8b9a8c308ea626/html5/thumbnails/14.jpg)
Omnet++ module structure
● Each simulated object is a module– Could be simple or nested
● Modules communicate through messages● Each module is composed by
– Interface description (NED)
– Behavior (C++ class)
– One or more .msg files
![Page 15: Omnet++ Introduction - unibo.itdonat/omnet.pdf · Outline What is Omnet++? How can I use it? How can it be useful for me? How much is it easy to develop in it? How much effort is](https://reader031.fdocuments.in/reader031/viewer/2022022009/5af18ace7f8b9a8c308ea626/html5/thumbnails/15.jpg)
NED example
![Page 16: Omnet++ Introduction - unibo.itdonat/omnet.pdf · Outline What is Omnet++? How can I use it? How can it be useful for me? How much is it easy to develop in it? How much effort is](https://reader031.fdocuments.in/reader031/viewer/2022022009/5af18ace7f8b9a8c308ea626/html5/thumbnails/16.jpg)
What should we declare in a NED?
● Module – the module definition● Channels – medium used to communicate● Parameters – to configure the module● Gates – where messages exit and enter● Connection – connections of gates
![Page 17: Omnet++ Introduction - unibo.itdonat/omnet.pdf · Outline What is Omnet++? How can I use it? How can it be useful for me? How much is it easy to develop in it? How much effort is](https://reader031.fdocuments.in/reader031/viewer/2022022009/5af18ace7f8b9a8c308ea626/html5/thumbnails/17.jpg)
NED compound modules
● Modules made of other modules (not only)● In omnet++ modules could be seen as a
black box● Through gates, you talk with someone else● Very easy to build complex modules● Very easy to change small things in big
simulations
![Page 18: Omnet++ Introduction - unibo.itdonat/omnet.pdf · Outline What is Omnet++? How can I use it? How can it be useful for me? How much is it easy to develop in it? How much effort is](https://reader031.fdocuments.in/reader031/viewer/2022022009/5af18ace7f8b9a8c308ea626/html5/thumbnails/18.jpg)
Compound module
Modules structure
Simple Module
Simple Module
Simple Module
Simple Module
Simple Module
Simple Module
Gates
![Page 19: Omnet++ Introduction - unibo.itdonat/omnet.pdf · Outline What is Omnet++? How can I use it? How can it be useful for me? How much is it easy to develop in it? How much effort is](https://reader031.fdocuments.in/reader031/viewer/2022022009/5af18ace7f8b9a8c308ea626/html5/thumbnails/19.jpg)
Networks
● A network is a .ned file
● Defines the layout of the simulation
● Could be further configured by omnetpp.ini (see later)
● Could be extended by other networks
![Page 20: Omnet++ Introduction - unibo.itdonat/omnet.pdf · Outline What is Omnet++? How can I use it? How can it be useful for me? How much is it easy to develop in it? How much effort is](https://reader031.fdocuments.in/reader031/viewer/2022022009/5af18ace7f8b9a8c308ea626/html5/thumbnails/20.jpg)
C/C++ modules
● Basically composed of three functions– initialize(int stage)
● Called when module is created
– handleMessage(cMessage *msg)● When a message arrives to the module
– Finish()● Called when module is destroyed
● Of course one can add more functions
![Page 21: Omnet++ Introduction - unibo.itdonat/omnet.pdf · Outline What is Omnet++? How can I use it? How can it be useful for me? How much is it easy to develop in it? How much effort is](https://reader031.fdocuments.in/reader031/viewer/2022022009/5af18ace7f8b9a8c308ea626/html5/thumbnails/21.jpg)
C/C++ modules
● Start by creating a subclass of cSimpleModule
● Declare initialize and handleMessage● Register the class with Define_Module()● Start adding your own methods● Schedule messages through:
– send → to other modules
– scheduleAt() → to yourself
![Page 22: Omnet++ Introduction - unibo.itdonat/omnet.pdf · Outline What is Omnet++? How can I use it? How can it be useful for me? How much is it easy to develop in it? How much effort is](https://reader031.fdocuments.in/reader031/viewer/2022022009/5af18ace7f8b9a8c308ea626/html5/thumbnails/22.jpg)
Messages
● Jobs, entities or any other kind of communication, customers
● Describe how to talk to others
● Place a .msg file inside a directory– C/C++ class is automatically generated
![Page 23: Omnet++ Introduction - unibo.itdonat/omnet.pdf · Outline What is Omnet++? How can I use it? How can it be useful for me? How much is it easy to develop in it? How much effort is](https://reader031.fdocuments.in/reader031/viewer/2022022009/5af18ace7f8b9a8c308ea626/html5/thumbnails/23.jpg)
Automaticallygenerated
Message example
message packet {fields:
int srcAddr;int destAddr;bool flag;
}
Header
C++ class
![Page 24: Omnet++ Introduction - unibo.itdonat/omnet.pdf · Outline What is Omnet++? How can I use it? How can it be useful for me? How much is it easy to develop in it? How much effort is](https://reader031.fdocuments.in/reader031/viewer/2022022009/5af18ace7f8b9a8c308ea626/html5/thumbnails/24.jpg)
Reading parameters
● Define only the structure of the module– Don't use magic numbers
● Use module parameters– Easier to configure different kind of
simulations
● Faster to run simulations
![Page 25: Omnet++ Introduction - unibo.itdonat/omnet.pdf · Outline What is Omnet++? How can I use it? How can it be useful for me? How much is it easy to develop in it? How much effort is](https://reader031.fdocuments.in/reader031/viewer/2022022009/5af18ace7f8b9a8c308ea626/html5/thumbnails/25.jpg)
Running a simulation
● Create an omnetpp.ini● Inside, you can configure your simulation● You can also have different configurations
to run● Very easy to replicate results
– Or to run the same simulation multiple times
![Page 26: Omnet++ Introduction - unibo.itdonat/omnet.pdf · Outline What is Omnet++? How can I use it? How can it be useful for me? How much is it easy to develop in it? How much effort is](https://reader031.fdocuments.in/reader031/viewer/2022022009/5af18ace7f8b9a8c308ea626/html5/thumbnails/26.jpg)
Analysis
● You (may) want to record what happens during the simulation
● You can record– Queue lenghts
– Percentages
– Packet drops
– ….
![Page 27: Omnet++ Introduction - unibo.itdonat/omnet.pdf · Outline What is Omnet++? How can I use it? How can it be useful for me? How much is it easy to develop in it? How much effort is](https://reader031.fdocuments.in/reader031/viewer/2022022009/5af18ace7f8b9a8c308ea626/html5/thumbnails/27.jpg)
Analysis
● Once you ran a simulation, you could have– .vec files – tstamp/values
– .sca files – summary of statistics
● These files contains the raw results of the simulation
● How can we (easily) read them?
![Page 28: Omnet++ Introduction - unibo.itdonat/omnet.pdf · Outline What is Omnet++? How can I use it? How can it be useful for me? How much is it easy to develop in it? How much effort is](https://reader031.fdocuments.in/reader031/viewer/2022022009/5af18ace7f8b9a8c308ea626/html5/thumbnails/28.jpg)
Chart generations
![Page 29: Omnet++ Introduction - unibo.itdonat/omnet.pdf · Outline What is Omnet++? How can I use it? How can it be useful for me? How much is it easy to develop in it? How much effort is](https://reader031.fdocuments.in/reader031/viewer/2022022009/5af18ace7f8b9a8c308ea626/html5/thumbnails/29.jpg)
Sequence diagrams
![Page 30: Omnet++ Introduction - unibo.itdonat/omnet.pdf · Outline What is Omnet++? How can I use it? How can it be useful for me? How much is it easy to develop in it? How much effort is](https://reader031.fdocuments.in/reader031/viewer/2022022009/5af18ace7f8b9a8c308ea626/html5/thumbnails/30.jpg)
Advices
● How to go from 0 to top in omnet++?– Impossible!
● Start with simple things● Add some details● Try, fail, try again, succeed● A place to start?
– http://www.omnetpp.org/documentation
– http://www.omnetpp.org/doc/omnetpp/tictoc-tutorial