omnet-tutorial - edited

advertisement
Introduction
1
 A Simulator
 Modular (Component-based)
 Open-architecture
 For Discrete Event Networks
 Various simulation models and frameworks
 For Specific Application Areas
 Mostly Open Source
 Developed Independently of OMNeT++
3
 Simulation Frameworks Based on OMNeT++:
 Mobility Framework
 Mobile & Wireless Simulations
 INET Framework
 Wired & Wireless TCP/IP Based Simulations
 Castalia
 Wireless Sensor Networks
 MiXiM
 Mobile & Wireless Simulations
 OverSim
 Overlay and Peer-to-Peer Networks (INET-based)
 NesCT
 OS simulations
 Consensus Positif and MAC Simulator
 for sensor networks
 CDNSim
 content distribution networks, youtube
 PAWiS
 Power Aware Wireless Sensor Networks Simulation
Framework
 Other:
 FIELDBUS, ACID SimTools, X-Simulator
5
 Flexibility
 Programming model
 Model management
 Debugging, tracing, and experiment specifications
 Simulation Modes
6
 Core framework for discrete event simulation.
 Different add-ons for specific purposes.
 Fully implemented in C++.
 Functionality added by deriving classes following
specified rules.
7
 Simulated objects are represented by modules
• Simple or Compound
• Communicate by messages (directly or via gates)
• Consists of
• Interface description (.NED file)
• Behavior description (C++ class)
 Modules, gates and links can be created:
• Statically - at the beginning of the simulation (NED file)
• Dynamically – during the simulation
 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 KOONESAZI blocks
9
 Supports
 Recording data vectors and scalars in output files
 Random numbers with several distributions and
different starting seeds
 displaying info about the module’s activity, snapshots,
breakpoints
 Easy to configure using .ini file
 Batch execution of the same simulation for
different parameters is also included
Command line
Interactive GUI
Tcl/Tk windowing, allows view what’s
happening and modify parameters at
run-time.
11
 The topology of a model is specified using the NED
language.
 Edit it with GNED or other text editor.
 Import directives
 Channel definitions
 Simple and compound module definitions
 Network definitions
 import "ethernet"; // imports ethernet.ned
 import
"Router",
"StandardHost",
"FlatNetworkConfigurator";
channel LeasedLine
delay 0.0018 // sec
error 1e-8
datarate 128000 // bit/sec
endchannel
simple TrafficGen
Application Layer
parameters:
interarrivalTime,
TrafficGen
numOfMessages : const,
address : string;
MAC Layer
gates:
in: fromPort, fromHigherLayer;
out: toPort, toHigherLayer;
endsimple
module CompoundModule
parameters: //...
gates: //...
submodules: //...
connections: //...
endmodule
module CompoundModule
//...
submodules:
submodule1: ModuleType1
parameters: //...
gatesizes: //...
submodule2: ModuleType2
parameters: //...
gatesizes: //...
endmodule
module CompoundModule
parameters:
param1: numeric,
param2: numeric,
useParam1: bool;
submodules:
submodule1: Node
parameters:
p1 = 10,
p2 = param1+param2,
p3 = useParam1==true ? param1 : param2;
//...
endmodule
module CompoundModule
parameters: //...
gates: //...
submodules: //...
connections:
node1.output --> node2.input;
node1.input <-- node2.output;
//...
endmodule
network wirelessLAN: WirelessLAN parameters:
numUsers=10, httpTraffic=true, ftpTraffic=true,
distanceFromHub=truncnormal(100,60);
endnetwork
 //
// Ethernet Modeling//
 simple EtherMAC {
parameters: string address; // others omitted for brevity
gates:
input phyIn;
// to physical layer or the network
output phyOut; // to physical layer or the network
input llcIn;
// to EtherLLC or higher layer
output llcOut; // to EtherLLC or higher layer
}
 //
// Host with an Ethernet interface
//
module EtherStation {
parameters: ...
gates: ...
input in; // connect to switch/hub,
etc
output out;
submodules:
network EtherLAN {
app: EtherTrafficGen;
submodules: EtherStation;
llc: EtherLLC;
…
mac: EtherMAC;
}
connections:
app.out --> llc.hlIn;
app.in <-- llc.hlOut;
llc.macIn <-- mac.llcOut;
llc.macOout --> mac.llcIn;
mac.phyIn <-- in;
mac.phyOut --> out;
}
 To run the executable, you need
an omnetpp.ini file.
 [General]
network = etherLAN
*.numStations = 20
**.frameLength = normal(200,1400)
**.station[0].numFramesToSend = 5000
**.station[1-5].numFramesToSend = 1000
**.station[*].numFramesToSend = 0
 NED files define the topology of network/modules
 A part of the model description
 Ini files define
 Simulation parameters
 Results to collect
 Random seeds
 This separation allows to change parameters without
modifying the model
 E.g. no need to recompile, experiments can be executed
as a batch
Add behavior
for (int i=0;i<10;i++) {
}
...
[General]
network=test_disk
Analyze
Run
[Parameters]
...
Set up parameters
Model
structure
Compile
26
Network
description
nedtool
compiler
Generated C++
code
Module
behavior C++
code
C++ compiler
C++ compiler
Linker
Simulation
program
Simulation
kernel
libraries
User
interface
libraries
 The capability to record simulation results
 by explicitly programming into the simple modules
 Output Vector
 omnetpp.vec
 Output Scalar Files
 omnetpp.sca
 Series of pairs timestamp, value
 Can store:
 queue length over time
 end-to-end delay of received packets
 packet drops or channel throughput
…
 Can be configured from omnetpp.ini
 Enable or disable recording individual output vectors
 Limit recording to a certain simulation time interval
 Capture behaviour over time
29
 Contain summary statistics
 number of packets sent
 number of packet drops
 average end-to-end delay of received packets
 peak throughput
…
30
Installation
33
Download