1 OMNET AND MIXIM FRAMEWORK Introduction What is

  • Slides: 63
Download presentation
1 OMNET++ AND MIXIM FRAMEWORK Introduction

1 OMNET++ AND MIXIM FRAMEWORK Introduction

What is OMNe. T++? OMNe. T++ is a component-based, modular and open-architecture discrete event

What is OMNe. T++? OMNe. T++ is a component-based, modular and open-architecture discrete event network simulator. OMNe. T++ represents a framework approach Instead of containing explicit and hardwired support for computer networks or other areas, it provides an infrastructure for writing such simulations Specific application areas are catered by various simulation models and frameworks, most of them open source. These models are developed completely independently of OMNe. T++, and follow their own

OMNET++ Frameworks Partial list of OMNe. T++-based network simulators and simulation frameworks: Mobility Framework

OMNET++ Frameworks Partial list of OMNe. T++-based network simulators and simulation frameworks: Mobility Framework -- for mobile and wireless simulations INET Framework -- for wired and wireless TCP/IP based simulations Castalia -- for wireless sensor networks Mi. Xi. M -- for mobile and wireless simulations More specialized, OMNe. T++-based simulators: Over. Sim -- for overlay and peer-to-peer networks (INET-based) Nes. CT -- for Tiny. OS simulations Consensus Positif and MAC Simulator -- for sensor networks Sim. SANs -- for storage area networks CDNSim -- for content distribution networks ACID Sim. Tools -- for simulation of concurrency control, atomic commit processing and recovery protocols X-Simulator -- for testing synchronization protocols FIELDBUS -- for simulation of control networks (fieldbuses) PAWi. S -- Power Aware Wireless Sensor Networks Simulation Framework

What is Mi. Xi. M? Mi. Xi. M project Mi. Xi. M (mixed simulator)

What is Mi. Xi. M? Mi. Xi. M project Mi. Xi. M (mixed simulator) is a simulation framework for wireless and mobile networks using the OMNe. T++ simulation engine Mi. Xi. M is a merger of several OMNe. T++ frameworks written to support mobile and wireless simulations The predecessors of Mi. Xi. M are: Ch. Sim by Universitaet Paderborn Mac Simulator by Technische Universiteit Delft Mobility Framework by Technische Universitaet Berlin, Telecommunication Networks Group Positif Framework by Technische Universiteit Delft

5 Important issues in a discrete event simulation environment Pseudorandom generators Flexibility Programming model

5 Important issues in a discrete event simulation environment Pseudorandom generators Flexibility Programming model Model management Support for hierarchical models Debugging, tracing, and experiment specifications Documentation Large scale simulation Parallel simulation

Flexibility 6 Core framework for discrete event simulation. Different add-ons for specific purposes. Fully

Flexibility 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.

OMNET++ Programming model Simulated objects are represented by modules � Modules can be simple

OMNET++ Programming model Simulated objects are represented by modules � Modules can be simple or composed (depth of module nesting is not limited) � Modules communicate by messages (sent directly or via gates) � One module description 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

Hierarchical models Node Application Network MAC Nic Phy Decider Analog Model Network interface card,

Hierarchical models Node Application Network MAC Nic Phy Decider Analog Model Network interface card, a compound module consisting of a simple module MAC and a compound module Phy

Model management 9 Clear separation among simulation kernel and developed models. Easiness of packaging

Model management 9 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

Debugging and tracking Support is offered for: � � � Recording data vectors and

Debugging and tracking Support is offered for: � � � Recording data vectors and scalars in output files Random numbers (also from several distributions) with different starting seeds Tracing and debugging aids (displaying info about the module’s activity, snapshots, breakpoints) Simulations are easy to configure using. ini file Batch execution of the same simulation for different parameters is also included 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. �

Simulation Model building 11 Add behavior for (int i=0; i<10; i++) { }. .

Simulation Model building 11 Add behavior for (int i=0; i<10; i++) { }. . . [General] network=test_disk Analyze Run [Parameters]. . . Set up parameters Model structure Compile

Build process Network description nedtool compiler Generated C++ code Module behavior C++ code C++

Build process Network description nedtool compiler Generated C++ code Module behavior C++ code C++ compiler Linker Simulation program Simulation kernel libraries User interface libraries

NED Overview The topology of a model is specified using the NED language. Edit

NED Overview The topology of a model is specified using the NED language. Edit it with GNED or other text editor.

Components of a NED description Import directives Channel definitions Simple and compound module definitions

Components of a NED description Import directives Channel definitions Simple and compound module definitions Network definitions

Import directives import "ethernet"; // imports ethernet. ned import "Router", "Standard. Host", "Flat. Network.

Import directives import "ethernet"; // imports ethernet. ned import "Router", "Standard. Host", "Flat. Network. Configurator";

Channel definitions channel Leased. Line delay 0. 0018 // sec error 1 e-8 datarate

Channel definitions channel Leased. Line delay 0. 0018 // sec error 1 e-8 datarate 128000 // bit/sec endchannel

Simple module definitions Application Layer simple Traffic. Gen parameters: Traffic. Gen interarrival. Time, num.

Simple module definitions Application Layer simple Traffic. Gen parameters: Traffic. Gen interarrival. Time, num. Of. Messages : const, MAC Layer address : string; gates: in: from. Port, from. Higher. Layer; out: to. Port, to. Higher. Layer; endsimple

Compound module definitions module Compound. Module parameters: //. . . gates: //. . .

Compound module definitions module Compound. Module parameters: //. . . gates: //. . . submodules: //. . . connections: //. . . endmodule

Compound module definitions - submodules module Compound. Module //. . . submodules: submodule 1:

Compound module definitions - submodules module Compound. Module //. . . submodules: submodule 1: Module. Type 1 parameters: //. . . gatesizes: //. . . submodule 2: Module. Type 2 parameters: //. . . gatesizes: //. . . endmodule

Assigning values to submodule parameters module Compound. Module parameters: param 1: numeric, param 2:

Assigning values to submodule parameters module Compound. Module parameters: param 1: numeric, param 2: numeric, use. Param 1: bool; submodules: submodule 1: Node parameters: p 1 = 10, p 2 = param 1+param 2, p 3 = use. Param 1==true ? param 1 : param 2; //. . . endmodule

Connections module Compound. Module parameters: //. . . gates: //. . . submodules: //.

Connections module Compound. Module parameters: //. . . gates: //. . . submodules: //. . . connections: node 1. output --> node 2. input; node 1. input <-- node 2. output; //. . . endmodule

Network definitions network wireless. LAN: Wireless. LAN parameters: num. Users=10, http. Traffic=true, ftp. Traffic=true,

Network definitions network wireless. LAN: Wireless. LAN parameters: num. Users=10, http. Traffic=true, ftp. Traffic=true, distance. From. Hub=truncnormal(100, 60); endnetwork

Simulation Model // // Ethernet CSMA/CD MAC // simple Ether. MAC { parameters: string

Simulation Model // // Ethernet CSMA/CD MAC // simple Ether. MAC { parameters: string address; // others omitted for brevity gates: input phy. In; // to physical layer or the network output phy. Out; // to physical layer or the network input llc. In; // to Ether. LLC or higher layer output llc. Out; // to Ether. LLC or higher layer } Modules can be connected with each other via gates and combined to form compound modules. Connections are created within a single level of module hierarchy: a submodule can be connected with another, or with the containing compound module. Every simulation model is an instance of a compound module type. This level (components and topology) is dealt with in NED files

Simulation Model // // Host with an Ethernet interface // module Ether. Station {

Simulation Model // // Host with an Ethernet interface // module Ether. Station { parameters: . . . gates: . . . input in; // connect to switch/hub, etc output out; submodules: app: Ether. Traffic. Gen; llc: Ether. LLC; mac: Ether. MAC; connections: app. out --> llc. hl. In; app. in <-- llc. hl. Out; llc. mac. In <-- mac. llc. Out; llc. mac. Oout --> mac. llc. In; mac. phy. In <-- in; mac. phy. Out --> out; } Simple modules which, like Ether. MAC, don't have further submodules and are backed up with C++ code that provides their active behavior, are declared with the simple keyword; compound modules are declared with the module keyword. To simulate an Ethernet LAN, you'd create a compound module Ether. LAN and announce that it can run by itself with the network keyword: network Ether. LAN { submodules: Ether. Station; … }

Running a model #> opp_make --deep creates a makefile with the appropriate settings #>

Running a model #> opp_make --deep creates a makefile with the appropriate settings #> make To run the executable, you need an omnetpp. ini file. Without it you get the following error: #> . /etherlan OMNe. T++/OMNEST Discrete Event Simulation (C) 1992 -2005 Andras Varga [. . ] <!> Error during startup: Cannot open ini file `omnetpp. ini'

Running a model (omnetpp. ini) [General] network = ether. LAN *. num. Stations =

Running a model (omnetpp. ini) [General] network = ether. LAN *. num. Stations = 20 **. frame. Length = normal(200, 1400) **. station[0]. num. Frames. To. Send = 5000 **. station[1 -5]. num. Frames. To. Send = 1000 **. station[*]. num. Frames. To. Send = 0 One function of the ini file is to tell which network to simulate. You can also specify in there which NED files to load dynamically, assign module parameters, specify how long the simulation should run, what seeds to use for random number generation, how much results to collect, set up several experiments with different parameter settings, etc.

Why use separate NED and ini files? NED files define the topology of network/modules

Why use separate NED and ini files? NED files define the topology of network/modules It is 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

Output of a simulation The simulation may write output vector and output scalar files

Output of a simulation The simulation may write output vector and output scalar files omnetpp. vec and omnetpp. sca The capability to record simulation results has to be explicitly programmed into the simple modules An output vector file contains several output vectors series of pairs timestamp, value They can store things like: You can configure output vectors from omnetpp. ini queue length over time, end-to-end delay of received packets, packet drops or channel throughput you can enable or disable recording individual output vectors, or limit recording to a certain simulation time interval Output vectors capture behaviour over time Output scalar files contain summary statistics number of packets sent, number of packet drops, average end-to-end delay of received packets, peak throughput

Mi. Xi. M

Mi. Xi. M

Mi. Xi. M World utility module provides global parameters of the environment (size, 2

Mi. Xi. M World utility module provides global parameters of the environment (size, 2 D or 3 D) Objects are used to model the environment Object. House, Object. Wall Objects influence radio signals and the mobility of other objects Object. Manager decides which objects are interfering Connection. Manager dynamically manages connections between objects Signal quality based on interference Signal quality based on mobility

Node Modules Application, network, MAC, and physical layers MAC and physical layers are grouped

Node Modules Application, network, MAC, and physical layers MAC and physical layers are grouped into a single Nic module A node with multiple Nic modules can be defined A laptop with bluetooth, GSM, and 802. 11 radios can be modeled

Node Modules Mobility module is responsible for the movements of an object Battery module

Node Modules Mobility module is responsible for the movements of an object Battery module used for modeling the energy reserve of nodes Communication, processing, mobility related energy consumption can be modeled Utility module is used for easy statistical data collection and inter-modular data passing (location, energy level etc. )

Connection Modeling In wireless simulations the channel connecting two nodes is the air A

Connection Modeling In wireless simulations the channel connecting two nodes is the air A broadcast medium that can not be represented with a single connection Theoretically a signal sent out by a node affects all other nodes in the simulation Since the signal is attenuated by the channel, as the distance to the source is increased the interference becomes negligible Mi. Xi. M sends all simultaneous signals to the connected nodes to let them decide on the final signal quality Maximal interference distance decides on the connectivity Definition of connection: All nodes that are not connected, definitely do not interfere with each other

Utility module Modules can publish observed parameters to the blackboard, a globally accessible service

Utility module Modules can publish observed parameters to the blackboard, a globally accessible service Other modules can subscribe to these published parameters to implement different data analysis methods for gathering results Dynamic parameters like location of a node or the energy levels can also be published so that other modules can change their behaviors accordingly

Example Base. Network. ned Base. Host. ned contains the compound module defining the network

Example Base. Network. ned Base. Host. ned contains the compound module defining the network interface card of the hosts config. xml contains the compound module defining the hosts for the network Base. Nic. ned contains the simulation network contains configuration for the physical layers decider and analogue models omnetpp. ini contains configuration for the simulation

Base. Nic. ned Mi. Xi. Ms provides two MAC layer implementations CSMAMac. Layer and

Base. Nic. ned Mi. Xi. Ms provides two MAC layer implementations CSMAMac. Layer and Mac 80211. If you use only Mi. Xi. Ms Decider and Analogue. Model implementations you can use the Phy. Layer module.

Base. Node. ned Base. Utility is a mandatory module Base. Arp is used for

Base. Node. ned Base. Utility is a mandatory module Base. Arp is used for address resolution IBase. Mobility is a mandatory module which defines current position and the movement pattern of the node. IBase. Appl. Layer, IBase. Netw. Layer and Base. Nic define the network stack of this host. IBase. Appl. Layer is the module for the application layer to use. You can implement you own by sub classing Mi. Xi. Ms "Base. Appl. Layer". INetw. Layer is the module for the network layer to use. Sub-class your own network layer from Mi. Xi. Ms Base. Netw. Layer.

Base. Network. ned Path inside Mi. Xi. M directory Module parameters § Connection. Manager

Base. Network. ned Path inside Mi. Xi. M directory Module parameters § Connection. Manager §checks if any two hosts can hear each other §updates their connections accordingly. § If two hosts are connected, they can receive something from each other § Base. World. Utility contains global utility methods and parameters § node[num. Nodes]: Base. Node § defines the hosts/nodes of our simulation. The base. Network example defines a network and an application layer on top of a NIC

config. xml The Analogue. Models section defines the analogue models to use. . You

config. xml The Analogue. Models section defines the analogue models to use. . You can find all of the already implemented Analogue. Models under "modules/analogue. Model/". The Decider section defines the Decider to use as well as its parameters. You can find all of the already implemented Deciders under "modules/phy/". You can set the XML file which defines the Decider and Analogue. Models of a physical layer by setting the "analogue. Models" and "decider" parameter of it in omnetpp. ini

omnet. ini

omnet. ini

Example II The MAC layer we want to implement will only implement the basic

Example II The MAC layer we want to implement will only implement the basic sending and receiving process Since implementing a Mac layers requires a lot message handling and state changing, it needs a lot of rather boring glue code, so we will only explain the interesting parts of the code

Tasks of the MAC layer Define start, duration, TX power mapping and bitrate mapping

Tasks of the MAC layer Define start, duration, TX power mapping and bitrate mapping of the Signal: Base. Mac. Layer provides the convenience method “create. Signal()” for simple signals Takes start, duration, TX power and bit-rate as parameters Returns a new Signal with a mapping representing the passed (constant) TX power and the passed (constant) bit-rate To define non constant TX power and / or bit-rate over time one will have to set the Mappings of the Signal manually.

Tasks of the MAC layer Channel sensing: “get. Channel. State()” - phy module method

Tasks of the MAC layer Channel sensing: “get. Channel. State()” - phy module method for instantaneous channel sensing. Control message of kind “Mac. To. Phy. Interface: : CHANNEL_SENSE_REQUEST” sent to phy module Requests the phy to sense the channel over a period of time Takes a timeout and a sense mode value UNTIL_TIMEOUT: is used to sense for the specified amount of time. UNTIL_IDLE: is used to sense until the channel is idle or until the timeout. UNTIL_BUSY: is used to sense until the channel is busy or until the timeout. both methods return a “Channel. State” object with an idle flag and the current RSSI value

Tasks of the MAC layer Switch radio: “set. Radio. State()” - phy module method

Tasks of the MAC layer Switch radio: “set. Radio. State()” - phy module method used to switch the radio. Takes the state to switch to as argument “Radio: : TX” “Radio: : RX” “Radio: : SLEEP” Returns the duration the switching will need. Control message of kind “RADIO_SWITCHING_OVER” from the physical layer indicates that the switching is over.

Write your own MAC layer class My. Mac. Layer : public Base. Mac. Layer

Write your own MAC layer class My. Mac. Layer : public Base. Mac. Layer { protected: c. Packet* packet. To. Send; enum Mac. State{ RX, CS, TX }; int mac. State; Channel. Sense. Request* ch. Sense; } "packet. To. Send" stores the packet from the upper layer we currently want to send down to the channel. "mac. State" will store the current state our MAC layer is in "ch. Sense" hold a "UNTIL_IDLE"-channel sense request which we will use to wait for the channel to turn idle.

Writing your own MAC layer • During initialization we set the initial state of

Writing your own MAC layer • During initialization we set the initial state of our MAC layer to receiving and we initialize or "UNTIL_IDLE"-request. • The first parameter to the constructor is the name for our message and the second is the kind, which has to be "Mac. To. Phy. Interface: : CHANNEL_SENSE_REQUEST" for every Channel. Sense. Request. • We further set the mode and the timeout (in seconds) of our request.

Writing your own MAC layer This is only a part of the actual "handle.

Writing your own MAC layer This is only a part of the actual "handle. Upper. Msg()" method it is called on reception of a packet which should be sent down to the channel. We store the packet for further processing and then we ask the phy module to do an instantaneous channel sense to see if the channel is currently idle. "get. Channel. State()" returns a Channel. State instance which provides an "is. Idle()" and "get. RSSI()" method. Both of the values are defined by the Decider of the phy module and especially the meaning of "is. Idle()" depends on the used Decider but in most cases it should indicate that we can send something to the channel without interfering with another transmission. If the channel is idle we can start the transmission process, if not we will need to start an "UNTIL_IDLE“ request to wait for it to turn back idle.

Writing your own MAC layer We set the MAC layers state to carrier sensing

Writing your own MAC layer We set the MAC layers state to carrier sensing and send our "UNTIL_IDLE“ request over the control channel down to the phy module. The phy module will hand it to its Decider and when the Decider says that the channel is idle again or the timeout is reached it will set the "Channel. State“ member of the request and send it back up to our MAC layer.

Writing your own MAC layer The Channel. Sense. Request we get back from the

Writing your own MAC layer The Channel. Sense. Request we get back from the phy module will be the same which we sent down but with the result of the sensing stored in its "Channel. State" member. If the result says that the channel is back idle we can start the transmission process, which is done in "transmitpacket()":

Writing your own MAC layer We see that we do not yet start transmitting

Writing your own MAC layer We see that we do not yet start transmitting the packet because we have to switch the radio to TX mode first. We do this by calling the phy modules "set. Radio. State()" method The method will return the time the switching process is over. The time it takes to switch from one radio state to another can be set as parameters of the phy module. As soon as the switching process is over the phy module will send us a message of kind "RADIO_SWITCHING_OVER" over the control channel. As soon as the radio is in TX mode we can start sending the packet to the channel which we do in "handle. Radio. Switched. To. TX()“ Here the packet we got from the upper layer is encapsulated into a Mac. Pkt and then sent down to the physical layer which will send it to the channel. During encapsulation the Signal for the packet is created and attached to it

Writing your own MAC layer The actual encapsulation is handled by Base. Mac. Layers

Writing your own MAC layer The actual encapsulation is handled by Base. Mac. Layers "encaps. Msg()" method. Our MAC layer is only responsible for creating and attaching the Signal. Since we will use a constant bit-rate and sending power for the whole transmission we can use the "create. Signal()" method provided by Base. Mac. Layer. It takes the start and the length of the signal to create as well as its sending power and bit-rate. The method then creates a constant mapping for the power and bit-rate, stores them in a new Signal and returns it to us. If you want to use a more complex power or bitrate mapping you'll have to create the signal and the Mappings by yourself. You can take a look at the implementation of the "create. Signal()" method to see how this basically works. The Signal then is added to the Mac. Pkts control info. Note: Since the MAC layer has to create the Signal it has to know the whole length of the packet, including the phy header (if there is one). The phy module itself does not change the length of the packet sent to it.

Writing your own MAC layer After the transmission of the packet is over the

Writing your own MAC layer After the transmission of the packet is over the phy module will send us a message of kind "TX_OVER" over the control channel. When this happens our MAC layer has to switch the radio back to RX state phy->set. Radio. State(Radio: : RX); Again the phy module will send us a "RADIO_SWITCHING_OVER" message as soon the switching process is over which we handle in "handle. Radio. Switched. To. RX()": Now the whole transmission process is over and our MAC layer goes back to receiving state

Links and readings http: //mixim. sourceforge. net http: //www. omnetpp. org/ “The OMNe. T++

Links and readings http: //mixim. sourceforge. net http: //www. omnetpp. org/ “The OMNe. T++ discrete event simulation system”, Varga A. Proceedings of the European Simulation Multiconference (ESM 2001), Prague, Czech Republic, 6– 9 June 2001 “Comparison of OMNET++ and other simulator for WSN simulation”, Xiaodong Xian; Weiren Shi; He Huang Industrial Electronics and Applications, 2008. ICIEA 2008. 3 rd IEEE Conference on “Simulating wireless and mobile networks in OMNe. T++ the Mi. Xi. M vision”, Proceedings of the 1 st international conference on Simulation tools and techniques for communications, networks and systems Marseille, France, 2008

Questions?

Questions?

55 OMNET++ AND MIXIM FRAMEWORK Installation

55 OMNET++ AND MIXIM FRAMEWORK Installation