SlideShare a Scribd company logo
1 of 53
Simulation using
          OMNeT++



            Jeromy Fu




Presentation_ID   © 2008 Cisco Systems, Inc. All rights reserved.   Cisco Confidential   1
Agenda
            Why simulation
            OMNeT++ core components
            Write your own simulation program




          Source: Placeholder for Notes is 14 points
Presentation_ID   © 2008 Cisco Systems, Inc. All rights reserved.   Cisco Confidential   2
Why simulation?
            Mathematical model, sometime difficult
            Impractical experiment , PlanetLab helps
            Provide reproducible results
            Complementary methods, mathematical model validated
             by simulation, simulation validate by experiments.




          Source: Placeholder for Notes is 14 points
Presentation_ID   © 2008 Cisco Systems, Inc. All rights reserved.   Cisco Confidential   3
Simulator
            Usability
             clean API, script language support, documentation
            Scalability
             multi-thread ,distributed simulation
            Statistics
            underlying network simulation
             network protocol, cross-traffic, link latency, topology




Presentation_ID   © 2008 Cisco Systems, Inc. All rights reserved.   Cisco Confidential   4
What is OMNeT++
            It’s not a simulator of anything concrete, but an object-
             oriented modular discrete event network simulation
             framework.
            Provides infrastructure and tools for writing simulators.
            Has a component architecture, can be used in various
             problem domains.
            Support TK/TCL GUI and Cmd GUI.
            Support parallel distributed simulation.
            Portable(Linux, Mac OS, Windows etc).
            Well documented.

Presentation_ID   © 2008 Cisco Systems, Inc. All rights reserved.   Cisco Confidential   5
Omnest – commercial product
            http://www.omnest.com/references.php
            http://www.omnest.com/webdemo/ide/demo.html




Presentation_ID   © 2008 Cisco Systems, Inc. All rights reserved.   Cisco Confidential   6
OMNet++ vs Omnest




Presentation_ID   © 2008 Cisco Systems, Inc. All rights reserved.   Cisco Confidential   7
DES(Discrete Event Simulation)
           initialize -- this includes building the model and inserting
           initial events to FES(Future Event Set)

           while ( FES not empty and simulation not yet complete)
           {
             retrieve first event from FES
             t := timestamp of this event
             process event
             (processing may insert new events in FES or delete
           existing ones)
           }
           

Presentation_ID   © 2008 Cisco Systems, Inc. All rights reserved.   Cisco Confidential   8
OMNeT++ core components
            Simple module
            Compound module
            Gate
            Channel




          Source: Placeholder for Notes is 14 points
Presentation_ID   © 2008 Cisco Systems, Inc. All rights reserved.   Cisco Confidential   9
Module
            Modules that contain sub-modules are termed
             compound modules, as opposed to simple modules at
             the lowest level of the module hierarchy.
            Simple modules contain the algorithms of the model.
             The user implements the simple modules in C++, using
             the OMNeT++ simulation class library.
            Model structure is described in OMNeT++’s NED
             language.




          Source: Placeholder for Notes is 14 points
Presentation_ID   © 2008 Cisco Systems, Inc. All rights reserved.   Cisco Confidential   10
Messages, Gates, Links and Channels
            Modules communicate by exchanging messages.
            Simple modules can send messages either directly to
             their destination or along a pre defined path, through
             gates and connections.
            Gates are the input and output interfaces of modules;
            Messages are sent out through output gates and arrive
             through input gates. Typically travel through a series of
             connections, starting and arriving in simple modules.
            Connections support the following parameters: data
             rate, propagation delay, bit error rate and packet error
             rate, and may be disabled.
          Source: Placeholder for Notes is 14 points
Presentation_ID   © 2008 Cisco Systems, Inc. All rights reserved.   Cisco Confidential   11
Simulation class library
            Module, gate, parameter, channel
            Message, packet
            Container classes(e.g. queue, array)
            Data collection classes
            Statistic and distribution estimation class
            Transient detection and result accuracy detection
             classes
            Reflection support for C++
            User Interface( GUI can even change the variable on-
             the-fly, cmd UI support batch execution)
Presentation_ID   © 2008 Cisco Systems, Inc. All rights reserved.   Cisco Confidential   12
Simulator relating files
            NED language topology description(s)(.ned files) that
             describe the module structure with parameters, gates,
             etc.
            Message definitions(.msg files). You can define various
             message types and add data fields to them. OMNeT++
             will translate message definitions into full-fledged C++
             classes.
            Simple module sources. They are C++ files, with .h/.cc
             suffix.




Presentation_ID   © 2008 Cisco Systems, Inc. All rights reserved.   Cisco Confidential   13
Simulation process
            Read all NED files, dynamically building up the network.
            Read configuration file which contains values for model
             parameters.
            Simulation runs until a pre-defined condition or user stop
             it through GUI.
            Logs, vector file and scalar files can be recorded.
            A variety of tools are provided for post-analyze and
             post-process.




Presentation_ID   © 2008 Cisco Systems, Inc. All rights reserved.   Cisco Confidential   14
Distribution directory




Presentation_ID   © 2008 Cisco Systems, Inc. All rights reserved.   Cisco Confidential   15
NED(Network Description)
            Hierarchical
            Component-based(support component libraries)
            Interfaces(concrete module or channel type can be
             specified by parameters)(single, multiple inheritance?)
            Inheritance
            Packages
            Inner types
            Metadata annotations



Presentation_ID   © 2008 Cisco Systems, Inc. All rights reserved.   Cisco Confidential   16
Simple module
            Defined with ‘simple’ keyword
            Have optional parameters and gates sections
            Operation of the module is expressed in C++ Class,
             which default have the same name with the module
             name.
            @class, @namespace
            Can be extended




Presentation_ID   © 2008 Cisco Systems, Inc. All rights reserved.   Cisco Confidential   17
Simple module
           simple Queue
           {
             parameters:
                    int capacity;
                    @class (mylib:Queue);
                    @display("i=block/queue");
             gates:
                    input in;
                    outpu out;
           }




Presentation_ID   © 2008 Cisco Systems, Inc. All rights reserved.   Cisco Confidential   18
Simple module
           Simple BoundedQueue extends Queue
           {
             capacity = 10;
           }

           Simple PriorityQueue extends Queue //correct solution
           {
             @class(PriorityQueue);
           }




Presentation_ID   © 2008 Cisco Systems, Inc. All rights reserved.   Cisco Confidential   19
Compound module
            Defined with ‘module’ keyword
            Group other modules into a large unit
            May have gates and params, but no behavior
             associated
            Have ‘submodules’ section, ‘connections’ section is
             optional
            Can defined inner module or channel types in ‘types’
             section.
            Can be extended



Presentation_ID   © 2008 Cisco Systems, Inc. All rights reserved.   Cisco Confidential   20
Compound module
           module WirelessHostBase
           {
             gates:
               input radioIn;
             submodules:
               tcp: TCP;
               ip: IP;
               wlan: Ieee80211;
             Connections:
               tcp.ipOut --> ip.tcpIn;
               tcp.ipIn <-- ip.tcpOut;
               ip.nicOut++ --> wlan.ipIn;
               ip.nicIn++ <-- wlan.ipOut;
               wlan.radioIn <-- radioIn;
           }
Presentation_ID   © 2008 Cisco Systems, Inc. All rights reserved.   Cisco Confidential   21
Compound module
         module WirelessUser extends WirelessHostBase
         {
           submodules:
             webAgent: WebAgent;
           Connections:
             webAgent.tcpOut --> tcp.appIn++;
             webAgent.tcpIn <-- tcp.appOut++;
         }




Presentation_ID   © 2008 Cisco Systems, Inc. All rights reserved.   Cisco Confidential   22
Compound module
         module DesktopUser extends WirelessUser
         {
           gates:
             inout ethg;
           submodules:
             eth: EthernetNic;
           connections:
             ip.nicOut++ --> eth.ipIn;
             ip.nicIn++ <-- eth.ipOut;
             eth.phy <--> ethg;
         }



Presentation_ID   © 2008 Cisco Systems, Inc. All rights reserved.   Cisco Confidential   23
Channels
            Channels encapsulate parameters and behavior
             associated with connections
            Have C++ classes behind them, so @class and
             @namespace etc works the same with simple module
            Can define channel Class, however, the defaults are
             enough(IdealChannel, DelayChannel, DatarateChannel)
            Can also be extended




Presentation_ID   © 2008 Cisco Systems, Inc. All rights reserved.   Cisco Confidential   24
Channels
           channel C extends ned.DatarateChannel
           {
             datarate = 100Mbps;
             delay = 100us;
             ber = 1e-10;
           }

           channel DatarateChannel2 extends ned.DatarateChannel
           {
             double distance @unit(m);
             delay = this.distance / 200000km * 1s;
           }

Presentation_ID   © 2008 Cisco Systems, Inc. All rights reserved.   Cisco Confidential   25
Parameters
            Parameters are variables that belong to a module
            Parameters can be used in building the topology
             (number of nodes, etc), and to supply input to C++ code
             that implements simple modules and channels
            Can be specified in NED files or in configuration(‘ini’),
             which one choose?
            support string, numeric or boolean values, or can
             contain XML data trees
            Can use expression, can set default, sizeof operator,
             ‘index’ of the current module, refer to already defined
             parameters, ‘volatile’
            @unit property
Presentation_ID   © 2008 Cisco Systems, Inc. All rights reserved.   Cisco Confidential   26
Gates
            Connection points of module
            Input, output, inout
            A module can have multiple gates(gate vector), size
             need not specified
            @loose, @directIn, ‘allowunconnected’ keyword




Presentation_ID   © 2008 Cisco Systems, Inc. All rights reserved.   Cisco Confidential   27
Gates
           simple Classifier{
             parameters:
                int numCategories;
             gates:
                input in[];
                output out[numCategories];
           }

           simple GridNode
           {
             gates:
                inout neighbour[4]@loose;
           }
Presentation_ID   © 2008 Cisco Systems, Inc. All rights reserved.   Cisco Confidential   28
Submodules
            A compound module can have multiple submodules
             (module vector), size SHOULD be specified.
            In submodule body, we can assign parameters, set the
             size of gate vector, add/modify properties.
            Add new parameters and gates is not permitted.




Presentation_ID   © 2008 Cisco Systems, Inc. All rights reserved.   Cisco Confidential   29
Submodules
          module Node
          {
            gates:
              inout port[];
            submodules:
              routing: Routing {
                  parameters: // this keyword is optional
                     routingTable = "routingtable.txt";
                  gates:
                     in[sizeof(port)]; // set gate vector size
                     out[sizeof(port)];
              }
              queue[sizeof(port)]: Queue {
                  @display("t=queue id $id"); //modify display string
                  id = 1000 + index; //different "id" parameter for each element
              }
            connetions:
              ...
          }
Presentation_ID   © 2008 Cisco Systems, Inc. All rights reserved.   Cisco Confidential   30
Connections
            Used for connecting gates
            Can not span across hierarchy levels
            ‘-->’,’<--’,’<-->’
            ‘gatename++’ notation




Presentation_ID   © 2008 Cisco Systems, Inc. All rights reserved.   Cisco Confidential   31
Connections
           ... <--> {delay=10ms;} <--> ...
           ... <--> {delay=10ms; ber=1e-8;} <--> ...
           ... <--> C <--> ...
           ... <--> BBone{cost=100; length=52km; ber=1e-8;} <--> ...
           ... <--> {@display("ls=red");} <--> ...
           ... <--> BBone{@display("ls=green,2");} <--> ...




Presentation_ID   © 2008 Cisco Systems, Inc. All rights reserved.   Cisco Confidential   32
Chain
           module Chain{
             parameters:
               int count;
             submodules:
               node[count]: Node{
                  gates:
                      inout port[2];
               }
             connections allowunconneted:
               for i = 0..count-2{
                  node[i].port[1] <--> node[i+1].port[0];
               }
           }
Presentation_ID   © 2008 Cisco Systems, Inc. All rights reserved.   Cisco Confidential   33
BinaryTree
           simple BinaryTreeNode {
             gates:
                inout left;
                inout right;
                inout parent;
           }

           module BinaryTree {
             parameters:
               int height;
             submodules:
               node[2^height-1]: BinaryTreeNode;
             connections allowunconnected:
               for i=0..2^(height-1)-2 {
                  node[i].left <--> node[2*i+1].parent;
                  node[i].right <--> node[2*i+2].parent;
               }
           }
Presentation_ID   © 2008 Cisco Systems, Inc. All rights reserved.   Cisco Confidential   34
RandomGraph
           module RandomGraph{
             parameters:
               int count;
               double connectedness; //0.0<x<1.0
             submodules:
               node[count]: Node {
                  gates:
                     in[count];
                     out[count];
               }
             connections allowunconneted:
               for i=0..count-1, for j=0..count-1{
                  node[i].out[j] --> node[j].in[i]
                     if i!=j && uniform(0,1)<connectedness;
               }
           }
Presentation_ID   © 2008 Cisco Systems, Inc. All rights reserved.   Cisco Confidential   35
Submodules type as a parameter
            A submodule type may be specified with a module
             parameter of the type string, or in general, with any
             string-typed expression.
            The syntax uses the ‘like’ keyword.

                            network Net6
                            {
                              parameters:
                                string nodeType;
                              submodules:
                                node[6]: <nodeType> like INode{
                                    address = index;
                                }
                              connections:
                                ...
                            }
Presentation_ID   © 2008 Cisco Systems, Inc. All rights reserved.   Cisco Confidential   36
Submodules type as a parameter
           moduleinterface INode
           {
             parameters:
               int address;
             gates:
               inout port[];
           }

           module SensorNode like INode
           {
             parameters:
               int address;
               ...
             gates:
               inout port[];
               ...
           }

Presentation_ID   © 2008 Cisco Systems, Inc. All rights reserved.   Cisco Confidential   37
Class Hierarchy




Presentation_ID   © 2008 Cisco Systems, Inc. All rights reserved.   Cisco Confidential   38
Simulation in pseudo code
           perform simulation run;

                  build network
                    (i.e. the system module and its submodules recursively)

                  insert starter messages for all submodules using activity()

                  do callInitialize() on system module

                  enter event loop // (described earlier)

                  if (event loop terminated normally) // i.e. no errors
                      do callFinish() on system module

                  clean up

Presentation_ID     © 2008 Cisco Systems, Inc. All rights reserved.   Cisco Confidential   39
Simulation in pseudo code
           callInitialize()
           {
             call to user-defined initialize() function
             if( module is compound )
                 for (each submodule)
                    do callInitialize() on submodule
           }

           callFinish()
           {
             if( module is compound )
                 for (each submodule)
                    do callFinish() on submodule
             call to user-defined finish() function
           }

Presentation_ID   © 2008 Cisco Systems, Inc. All rights reserved.   Cisco Confidential   40
Event loop in more detail
           while ( FES not empty and simulation not yet complete )
           {
             retreive first event from FES
             t := timestamp of this event
             m := module containing this event
             if ( m works with handleMessage() )
                 m->handleMessage(event)
             else // m works with activity()
                 transferTo(m)
           }




Presentation_ID   © 2008 Cisco Systems, Inc. All rights reserved.   Cisco Confidential   41
activity() vs handleMessage()
            activity(), implemented using fiber in win32, coding more
             or less like multi-thread, simple, but consume more
             memory usage(stack), bad coding style. Not
             recommendate.


            handleMessage(), messaged-based, event-driver.




Presentation_ID   © 2008 Cisco Systems, Inc. All rights reserved.   Cisco Confidential   42
Message processing in handleMessage()
            Send()
            ScheduleAt()
            CancelEvent()
            DO NOT use receive() and wait(), they’re used in
             activity()




Presentation_ID   © 2008 Cisco Systems, Inc. All rights reserved.   Cisco Confidential   43
Simple Module example
           class Generator : public cSimpleModule
           {
           public:
              Generator(): cSimpleModule() {}
           protected:
              virtual void initialize();
              virtual void handleMessage(cMessage *msg);
           }

           Define_Module(Generator);




Presentation_ID   © 2008 Cisco Systems, Inc. All rights reserved.   Cisco Confidential   44
Simple Module example
           void Generator::initialize()
           {
             // schedule first sending
             scheduleAt(simTime(), new cMessage);
           }

           void Generator::handleMessage(cMessage* msg)
           {
             // generate & send packet
             cMessage * pkt = new cMessage;
             send(pkt, "out");
             // schedule next call
             scheduleAt(simTime() + exponential(1.0), msg);
           }
Presentation_ID   © 2008 Cisco Systems, Inc. All rights reserved.   Cisco Confidential   45
Message definition
            setter and getter
            reflection provided for messages(just like java)
            Compiled into .h and .cc files
            Can be used to define message and packets




Presentation_ID   © 2008 Cisco Systems, Inc. All rights reserved.   Cisco Confidential   46
Steps for application
                  1. Create a working directory called tictoc.
                  2. Describe your example network by creating a topology
                  file(*.ned).
                  3. We now need to implement the functionality of the simple
                  module(*.cc).
                  4. We now create the Makefile which will help us to compile and
                  link our program to create the executable tictoc:
                         $ opp_makemake
                  5. Compile and link our very first simulation by making command:
                         $ make
                  6.you have to create one. omnetpp.ini tells the simulation program
                  which network you want to simulate
                  7. Once you complete the above steps, you launch the simulation.
Presentation_ID     © 2008 Cisco Systems, Inc. All rights reserved.   Cisco Confidential   47
Building and running simulation




Presentation_ID   © 2008 Cisco Systems, Inc. All rights reserved.   Cisco Confidential   48
Tic-toc example: tictoc1.ned




Presentation_ID   © 2008 Cisco Systems, Inc. All rights reserved.   Cisco Confidential   49
Tic-toc example: txc1.cc




Presentation_ID   © 2008 Cisco Systems, Inc. All rights reserved.   Cisco Confidential   50
Tic-toc example: txc1.cc




Presentation_ID   © 2008 Cisco Systems, Inc. All rights reserved.   Cisco Confidential   51
One-hop simulation




Presentation_ID   © 2008 Cisco Systems, Inc. All rights reserved.   Cisco Confidential   52
Q and A




Presentation_ID   © 2008 Cisco Systems, Inc. All rights reserved.   Cisco Confidential   53

More Related Content

What's hot

Tp snmp-packet-tracer
Tp snmp-packet-tracerTp snmp-packet-tracer
Tp snmp-packet-tracerChris Dogny
 
Computer Networks - Unit 1 PPT
Computer Networks - Unit 1 PPTComputer Networks - Unit 1 PPT
Computer Networks - Unit 1 PPTKalpanaC14
 
Session Initiation Protocol
Session Initiation ProtocolSession Initiation Protocol
Session Initiation ProtocolMatt Bynum
 
process management
 process management process management
process managementAshish Kumar
 
Chapter 21 - The Linux System
Chapter 21 - The Linux SystemChapter 21 - The Linux System
Chapter 21 - The Linux SystemWayne Jones Jnr
 
Diaporamas-Réseaux Informatiques.pdf
Diaporamas-Réseaux Informatiques.pdfDiaporamas-Réseaux Informatiques.pdf
Diaporamas-Réseaux Informatiques.pdfEST-UMI de Meknès
 
UDP - User Datagram Protocol
UDP - User Datagram ProtocolUDP - User Datagram Protocol
UDP - User Datagram ProtocolPeter R. Egli
 
Tutorial 5 adding more nodes
Tutorial 5   adding more nodes Tutorial 5   adding more nodes
Tutorial 5 adding more nodes Mohd Batati
 
Ports and protocols
Ports and protocolsPorts and protocols
Ports and protocolssiva rama
 
CCNA 2 Routing and Switching v5.0 Chapter 7
CCNA 2 Routing and Switching v5.0 Chapter 7CCNA 2 Routing and Switching v5.0 Chapter 7
CCNA 2 Routing and Switching v5.0 Chapter 7Nil Menon
 
(équipements réseau)
(équipements réseau)(équipements réseau)
(équipements réseau)Anouar Abtoy
 
Doc portail-captif-pfsense
Doc portail-captif-pfsenseDoc portail-captif-pfsense
Doc portail-captif-pfsenseservinfo
 
18CS2005 Cryptography and Network Security
18CS2005 Cryptography and Network Security18CS2005 Cryptography and Network Security
18CS2005 Cryptography and Network SecurityKathirvel Ayyaswamy
 
Computer Security Lecture 1: Overview
Computer Security Lecture 1: OverviewComputer Security Lecture 1: Overview
Computer Security Lecture 1: OverviewMohamed Loey
 
Fonctionnalités et protocoles des couches applicatives
Fonctionnalités et protocoles des couches applicativesFonctionnalités et protocoles des couches applicatives
Fonctionnalités et protocoles des couches applicativesfadelaBritel
 
Chapitre 2: Modèle de référence OSI
Chapitre 2: Modèle de référence OSIChapitre 2: Modèle de référence OSI
Chapitre 2: Modèle de référence OSIMohamed Lahby
 
Network Essentials
Network EssentialsNetwork Essentials
Network EssentialsIffu Slides
 

What's hot (20)

Tp snmp-packet-tracer
Tp snmp-packet-tracerTp snmp-packet-tracer
Tp snmp-packet-tracer
 
Commutation
CommutationCommutation
Commutation
 
Computer Networks - Unit 1 PPT
Computer Networks - Unit 1 PPTComputer Networks - Unit 1 PPT
Computer Networks - Unit 1 PPT
 
Session Initiation Protocol
Session Initiation ProtocolSession Initiation Protocol
Session Initiation Protocol
 
process management
 process management process management
process management
 
Chapter 21 - The Linux System
Chapter 21 - The Linux SystemChapter 21 - The Linux System
Chapter 21 - The Linux System
 
Netacad
NetacadNetacad
Netacad
 
Diaporamas-Réseaux Informatiques.pdf
Diaporamas-Réseaux Informatiques.pdfDiaporamas-Réseaux Informatiques.pdf
Diaporamas-Réseaux Informatiques.pdf
 
UDP - User Datagram Protocol
UDP - User Datagram ProtocolUDP - User Datagram Protocol
UDP - User Datagram Protocol
 
Tutorial 5 adding more nodes
Tutorial 5   adding more nodes Tutorial 5   adding more nodes
Tutorial 5 adding more nodes
 
Ports and protocols
Ports and protocolsPorts and protocols
Ports and protocols
 
Subnetting
SubnettingSubnetting
Subnetting
 
CCNA 2 Routing and Switching v5.0 Chapter 7
CCNA 2 Routing and Switching v5.0 Chapter 7CCNA 2 Routing and Switching v5.0 Chapter 7
CCNA 2 Routing and Switching v5.0 Chapter 7
 
(équipements réseau)
(équipements réseau)(équipements réseau)
(équipements réseau)
 
Doc portail-captif-pfsense
Doc portail-captif-pfsenseDoc portail-captif-pfsense
Doc portail-captif-pfsense
 
18CS2005 Cryptography and Network Security
18CS2005 Cryptography and Network Security18CS2005 Cryptography and Network Security
18CS2005 Cryptography and Network Security
 
Computer Security Lecture 1: Overview
Computer Security Lecture 1: OverviewComputer Security Lecture 1: Overview
Computer Security Lecture 1: Overview
 
Fonctionnalités et protocoles des couches applicatives
Fonctionnalités et protocoles des couches applicativesFonctionnalités et protocoles des couches applicatives
Fonctionnalités et protocoles des couches applicatives
 
Chapitre 2: Modèle de référence OSI
Chapitre 2: Modèle de référence OSIChapitre 2: Modèle de référence OSI
Chapitre 2: Modèle de référence OSI
 
Network Essentials
Network EssentialsNetwork Essentials
Network Essentials
 

Similar to Simulation using OMNet++

Sca n instructorppt_chapter1_final
Sca n instructorppt_chapter1_finalSca n instructorppt_chapter1_final
Sca n instructorppt_chapter1_finalCamTESOL2015
 
CCNAv5 - S3: Chapter1 Introduction to Scaling Networks
CCNAv5 - S3: Chapter1 Introduction to Scaling NetworksCCNAv5 - S3: Chapter1 Introduction to Scaling Networks
CCNAv5 - S3: Chapter1 Introduction to Scaling NetworksVuz Dở Hơi
 
CCNAv5 - S4: Chapter 7: Securing Site-to-site Connectivity
CCNAv5 - S4: Chapter 7: Securing Site-to-site ConnectivityCCNAv5 - S4: Chapter 7: Securing Site-to-site Connectivity
CCNAv5 - S4: Chapter 7: Securing Site-to-site ConnectivityVuz Dở Hơi
 
CCNAv5 - S4: Chapter 1 Hierarchical Network Design
CCNAv5 - S4: Chapter 1 Hierarchical Network DesignCCNAv5 - S4: Chapter 1 Hierarchical Network Design
CCNAv5 - S4: Chapter 1 Hierarchical Network DesignVuz Dở Hơi
 
CCNA RS_ITN - Chapter 2
CCNA RS_ITN - Chapter 2CCNA RS_ITN - Chapter 2
CCNA RS_ITN - Chapter 2Irsandi Hasan
 
Chapter 2 : Configuring a network operating system
Chapter 2 : Configuring a network operating systemChapter 2 : Configuring a network operating system
Chapter 2 : Configuring a network operating systemteknetir
 
CCNAv5 - S1: Chapter 2 - Configuring a network operating system
CCNAv5 - S1: Chapter 2 - Configuring a network operating systemCCNAv5 - S1: Chapter 2 - Configuring a network operating system
CCNAv5 - S1: Chapter 2 - Configuring a network operating systemVuz Dở Hơi
 
Chapter 02 - Configuring a Network Operating System
Chapter 02 - Configuring a Network Operating SystemChapter 02 - Configuring a Network Operating System
Chapter 02 - Configuring a Network Operating SystemYaser Rahmati
 
CCNAv5 - S4: Chapter3 Point to-point Connections
CCNAv5 - S4: Chapter3 Point to-point ConnectionsCCNAv5 - S4: Chapter3 Point to-point Connections
CCNAv5 - S4: Chapter3 Point to-point ConnectionsVuz Dở Hơi
 
CCNA RS_NB - Chapter 2
CCNA RS_NB - Chapter 2CCNA RS_NB - Chapter 2
CCNA RS_NB - Chapter 2Irsandi Hasan
 
CCNA 2 Routing and Switching v5.0 Chapter 1
CCNA 2 Routing and Switching v5.0 Chapter 1CCNA 2 Routing and Switching v5.0 Chapter 1
CCNA 2 Routing and Switching v5.0 Chapter 1Nil Menon
 
CCNA 1 Routing and Switching v5.0 Chapter 2
CCNA 1 Routing and Switching v5.0 Chapter 2CCNA 1 Routing and Switching v5.0 Chapter 2
CCNA 1 Routing and Switching v5.0 Chapter 2Nil Menon
 
Cisco packettracer overview_20jul09
Cisco packettracer overview_20jul09Cisco packettracer overview_20jul09
Cisco packettracer overview_20jul09rahmanitayulia
 
CCNA RS_ITN - Chapter 3
CCNA RS_ITN - Chapter 3CCNA RS_ITN - Chapter 3
CCNA RS_ITN - Chapter 3Irsandi Hasan
 
Chapter 12 : Introduction to switched networks
Chapter 12 : Introduction to switched networksChapter 12 : Introduction to switched networks
Chapter 12 : Introduction to switched networksteknetir
 
CCNA 1 Routing and Switching v5.0 Chapter 3
CCNA 1 Routing and Switching v5.0 Chapter 3CCNA 1 Routing and Switching v5.0 Chapter 3
CCNA 1 Routing and Switching v5.0 Chapter 3Nil Menon
 
Ccna v5-S1-Chapter 3
Ccna v5-S1-Chapter 3Ccna v5-S1-Chapter 3
Ccna v5-S1-Chapter 3Hamza Malik
 

Similar to Simulation using OMNet++ (20)

Sca n instructorppt_chapter1_final
Sca n instructorppt_chapter1_finalSca n instructorppt_chapter1_final
Sca n instructorppt_chapter1_final
 
CCNAv5 - S3: Chapter1 Introduction to Scaling Networks
CCNAv5 - S3: Chapter1 Introduction to Scaling NetworksCCNAv5 - S3: Chapter1 Introduction to Scaling Networks
CCNAv5 - S3: Chapter1 Introduction to Scaling Networks
 
CCNAv5 - S4: Chapter 7: Securing Site-to-site Connectivity
CCNAv5 - S4: Chapter 7: Securing Site-to-site ConnectivityCCNAv5 - S4: Chapter 7: Securing Site-to-site Connectivity
CCNAv5 - S4: Chapter 7: Securing Site-to-site Connectivity
 
CCNAv5 - S4: Chapter 1 Hierarchical Network Design
CCNAv5 - S4: Chapter 1 Hierarchical Network DesignCCNAv5 - S4: Chapter 1 Hierarchical Network Design
CCNAv5 - S4: Chapter 1 Hierarchical Network Design
 
Ccna routing and_switching_chapter-1-2-3_mme
Ccna routing and_switching_chapter-1-2-3_mmeCcna routing and_switching_chapter-1-2-3_mme
Ccna routing and_switching_chapter-1-2-3_mme
 
CCNA RS_ITN - Chapter 2
CCNA RS_ITN - Chapter 2CCNA RS_ITN - Chapter 2
CCNA RS_ITN - Chapter 2
 
Chapter 2 : Configuring a network operating system
Chapter 2 : Configuring a network operating systemChapter 2 : Configuring a network operating system
Chapter 2 : Configuring a network operating system
 
CCNAv5 - S1: Chapter 2 - Configuring a network operating system
CCNAv5 - S1: Chapter 2 - Configuring a network operating systemCCNAv5 - S1: Chapter 2 - Configuring a network operating system
CCNAv5 - S1: Chapter 2 - Configuring a network operating system
 
Chapter 02 - Configuring a Network Operating System
Chapter 02 - Configuring a Network Operating SystemChapter 02 - Configuring a Network Operating System
Chapter 02 - Configuring a Network Operating System
 
CCNAv5 - S4: Chapter3 Point to-point Connections
CCNAv5 - S4: Chapter3 Point to-point ConnectionsCCNAv5 - S4: Chapter3 Point to-point Connections
CCNAv5 - S4: Chapter3 Point to-point Connections
 
CCNA RS_NB - Chapter 2
CCNA RS_NB - Chapter 2CCNA RS_NB - Chapter 2
CCNA RS_NB - Chapter 2
 
CCNA 2 Routing and Switching v5.0 Chapter 1
CCNA 2 Routing and Switching v5.0 Chapter 1CCNA 2 Routing and Switching v5.0 Chapter 1
CCNA 2 Routing and Switching v5.0 Chapter 1
 
CCNA 1 Routing and Switching v5.0 Chapter 2
CCNA 1 Routing and Switching v5.0 Chapter 2CCNA 1 Routing and Switching v5.0 Chapter 2
CCNA 1 Routing and Switching v5.0 Chapter 2
 
Cisco packettracer overview_20jul09
Cisco packettracer overview_20jul09Cisco packettracer overview_20jul09
Cisco packettracer overview_20jul09
 
CCNA RS_ITN - Chapter 3
CCNA RS_ITN - Chapter 3CCNA RS_ITN - Chapter 3
CCNA RS_ITN - Chapter 3
 
Om net++
Om net++Om net++
Om net++
 
Chapter 12 : Introduction to switched networks
Chapter 12 : Introduction to switched networksChapter 12 : Introduction to switched networks
Chapter 12 : Introduction to switched networks
 
Mina2
Mina2Mina2
Mina2
 
CCNA 1 Routing and Switching v5.0 Chapter 3
CCNA 1 Routing and Switching v5.0 Chapter 3CCNA 1 Routing and Switching v5.0 Chapter 3
CCNA 1 Routing and Switching v5.0 Chapter 3
 
Ccna v5-S1-Chapter 3
Ccna v5-S1-Chapter 3Ccna v5-S1-Chapter 3
Ccna v5-S1-Chapter 3
 

Recently uploaded

Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAzure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAndikSusilo4
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphNeo4j
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksSoftradix Technologies
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxOnBoard
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...HostedbyConfluent
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhisoniya singh
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 

Recently uploaded (20)

Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAzure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & Application
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other Frameworks
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food Manufacturing
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptx
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 

Simulation using OMNet++

  • 1. Simulation using OMNeT++ Jeromy Fu Presentation_ID © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 1
  • 2. Agenda  Why simulation  OMNeT++ core components  Write your own simulation program Source: Placeholder for Notes is 14 points Presentation_ID © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 2
  • 3. Why simulation?  Mathematical model, sometime difficult  Impractical experiment , PlanetLab helps  Provide reproducible results  Complementary methods, mathematical model validated by simulation, simulation validate by experiments. Source: Placeholder for Notes is 14 points Presentation_ID © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 3
  • 4. Simulator  Usability clean API, script language support, documentation  Scalability multi-thread ,distributed simulation  Statistics  underlying network simulation network protocol, cross-traffic, link latency, topology Presentation_ID © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 4
  • 5. What is OMNeT++  It’s not a simulator of anything concrete, but an object- oriented modular discrete event network simulation framework.  Provides infrastructure and tools for writing simulators.  Has a component architecture, can be used in various problem domains.  Support TK/TCL GUI and Cmd GUI.  Support parallel distributed simulation.  Portable(Linux, Mac OS, Windows etc).  Well documented. Presentation_ID © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 5
  • 6. Omnest – commercial product  http://www.omnest.com/references.php  http://www.omnest.com/webdemo/ide/demo.html Presentation_ID © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 6
  • 7. OMNet++ vs Omnest Presentation_ID © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 7
  • 8. DES(Discrete Event Simulation) initialize -- this includes building the model and inserting initial events to FES(Future Event Set) while ( FES not empty and simulation not yet complete) { retrieve first event from FES t := timestamp of this event process event (processing may insert new events in FES or delete existing ones) }  Presentation_ID © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 8
  • 9. OMNeT++ core components  Simple module  Compound module  Gate  Channel Source: Placeholder for Notes is 14 points Presentation_ID © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 9
  • 10. Module  Modules that contain sub-modules are termed compound modules, as opposed to simple modules at the lowest level of the module hierarchy.  Simple modules contain the algorithms of the model. The user implements the simple modules in C++, using the OMNeT++ simulation class library.  Model structure is described in OMNeT++’s NED language. Source: Placeholder for Notes is 14 points Presentation_ID © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 10
  • 11. Messages, Gates, Links and Channels  Modules communicate by exchanging messages.  Simple modules can send messages either directly to their destination or along a pre defined path, through gates and connections.  Gates are the input and output interfaces of modules;  Messages are sent out through output gates and arrive through input gates. Typically travel through a series of connections, starting and arriving in simple modules.  Connections support the following parameters: data rate, propagation delay, bit error rate and packet error rate, and may be disabled. Source: Placeholder for Notes is 14 points Presentation_ID © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 11
  • 12. Simulation class library  Module, gate, parameter, channel  Message, packet  Container classes(e.g. queue, array)  Data collection classes  Statistic and distribution estimation class  Transient detection and result accuracy detection classes  Reflection support for C++  User Interface( GUI can even change the variable on- the-fly, cmd UI support batch execution) Presentation_ID © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 12
  • 13. Simulator relating files  NED language topology description(s)(.ned files) that describe the module structure with parameters, gates, etc.  Message definitions(.msg files). You can define various message types and add data fields to them. OMNeT++ will translate message definitions into full-fledged C++ classes.  Simple module sources. They are C++ files, with .h/.cc suffix. Presentation_ID © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 13
  • 14. Simulation process  Read all NED files, dynamically building up the network.  Read configuration file which contains values for model parameters.  Simulation runs until a pre-defined condition or user stop it through GUI.  Logs, vector file and scalar files can be recorded.  A variety of tools are provided for post-analyze and post-process. Presentation_ID © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 14
  • 15. Distribution directory Presentation_ID © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 15
  • 16. NED(Network Description)  Hierarchical  Component-based(support component libraries)  Interfaces(concrete module or channel type can be specified by parameters)(single, multiple inheritance?)  Inheritance  Packages  Inner types  Metadata annotations Presentation_ID © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 16
  • 17. Simple module  Defined with ‘simple’ keyword  Have optional parameters and gates sections  Operation of the module is expressed in C++ Class, which default have the same name with the module name.  @class, @namespace  Can be extended Presentation_ID © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 17
  • 18. Simple module simple Queue { parameters: int capacity; @class (mylib:Queue); @display("i=block/queue"); gates: input in; outpu out; } Presentation_ID © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 18
  • 19. Simple module Simple BoundedQueue extends Queue { capacity = 10; } Simple PriorityQueue extends Queue //correct solution { @class(PriorityQueue); } Presentation_ID © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 19
  • 20. Compound module  Defined with ‘module’ keyword  Group other modules into a large unit  May have gates and params, but no behavior associated  Have ‘submodules’ section, ‘connections’ section is optional  Can defined inner module or channel types in ‘types’ section.  Can be extended Presentation_ID © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 20
  • 21. Compound module module WirelessHostBase { gates: input radioIn; submodules: tcp: TCP; ip: IP; wlan: Ieee80211; Connections: tcp.ipOut --> ip.tcpIn; tcp.ipIn <-- ip.tcpOut; ip.nicOut++ --> wlan.ipIn; ip.nicIn++ <-- wlan.ipOut; wlan.radioIn <-- radioIn; } Presentation_ID © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 21
  • 22. Compound module module WirelessUser extends WirelessHostBase { submodules: webAgent: WebAgent; Connections: webAgent.tcpOut --> tcp.appIn++; webAgent.tcpIn <-- tcp.appOut++; } Presentation_ID © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 22
  • 23. Compound module module DesktopUser extends WirelessUser { gates: inout ethg; submodules: eth: EthernetNic; connections: ip.nicOut++ --> eth.ipIn; ip.nicIn++ <-- eth.ipOut; eth.phy <--> ethg; } Presentation_ID © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 23
  • 24. Channels  Channels encapsulate parameters and behavior associated with connections  Have C++ classes behind them, so @class and @namespace etc works the same with simple module  Can define channel Class, however, the defaults are enough(IdealChannel, DelayChannel, DatarateChannel)  Can also be extended Presentation_ID © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 24
  • 25. Channels channel C extends ned.DatarateChannel { datarate = 100Mbps; delay = 100us; ber = 1e-10; } channel DatarateChannel2 extends ned.DatarateChannel { double distance @unit(m); delay = this.distance / 200000km * 1s; } Presentation_ID © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 25
  • 26. Parameters  Parameters are variables that belong to a module  Parameters can be used in building the topology (number of nodes, etc), and to supply input to C++ code that implements simple modules and channels  Can be specified in NED files or in configuration(‘ini’), which one choose?  support string, numeric or boolean values, or can contain XML data trees  Can use expression, can set default, sizeof operator, ‘index’ of the current module, refer to already defined parameters, ‘volatile’  @unit property Presentation_ID © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 26
  • 27. Gates  Connection points of module  Input, output, inout  A module can have multiple gates(gate vector), size need not specified  @loose, @directIn, ‘allowunconnected’ keyword Presentation_ID © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 27
  • 28. Gates simple Classifier{ parameters: int numCategories; gates: input in[]; output out[numCategories]; } simple GridNode { gates: inout neighbour[4]@loose; } Presentation_ID © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 28
  • 29. Submodules  A compound module can have multiple submodules (module vector), size SHOULD be specified.  In submodule body, we can assign parameters, set the size of gate vector, add/modify properties.  Add new parameters and gates is not permitted. Presentation_ID © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 29
  • 30. Submodules module Node { gates: inout port[]; submodules: routing: Routing { parameters: // this keyword is optional routingTable = "routingtable.txt"; gates: in[sizeof(port)]; // set gate vector size out[sizeof(port)]; } queue[sizeof(port)]: Queue { @display("t=queue id $id"); //modify display string id = 1000 + index; //different "id" parameter for each element } connetions: ... } Presentation_ID © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 30
  • 31. Connections  Used for connecting gates  Can not span across hierarchy levels  ‘-->’,’<--’,’<-->’  ‘gatename++’ notation Presentation_ID © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 31
  • 32. Connections ... <--> {delay=10ms;} <--> ... ... <--> {delay=10ms; ber=1e-8;} <--> ... ... <--> C <--> ... ... <--> BBone{cost=100; length=52km; ber=1e-8;} <--> ... ... <--> {@display("ls=red");} <--> ... ... <--> BBone{@display("ls=green,2");} <--> ... Presentation_ID © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 32
  • 33. Chain module Chain{ parameters: int count; submodules: node[count]: Node{ gates: inout port[2]; } connections allowunconneted: for i = 0..count-2{ node[i].port[1] <--> node[i+1].port[0]; } } Presentation_ID © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 33
  • 34. BinaryTree simple BinaryTreeNode { gates: inout left; inout right; inout parent; } module BinaryTree { parameters: int height; submodules: node[2^height-1]: BinaryTreeNode; connections allowunconnected: for i=0..2^(height-1)-2 { node[i].left <--> node[2*i+1].parent; node[i].right <--> node[2*i+2].parent; } } Presentation_ID © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 34
  • 35. RandomGraph module RandomGraph{ parameters: int count; double connectedness; //0.0<x<1.0 submodules: node[count]: Node { gates: in[count]; out[count]; } connections allowunconneted: for i=0..count-1, for j=0..count-1{ node[i].out[j] --> node[j].in[i] if i!=j && uniform(0,1)<connectedness; } } Presentation_ID © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 35
  • 36. Submodules type as a parameter  A submodule type may be specified with a module parameter of the type string, or in general, with any string-typed expression.  The syntax uses the ‘like’ keyword. network Net6 { parameters: string nodeType; submodules: node[6]: <nodeType> like INode{ address = index; } connections: ... } Presentation_ID © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 36
  • 37. Submodules type as a parameter moduleinterface INode { parameters: int address; gates: inout port[]; } module SensorNode like INode { parameters: int address; ... gates: inout port[]; ... } Presentation_ID © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 37
  • 38. Class Hierarchy Presentation_ID © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 38
  • 39. Simulation in pseudo code perform simulation run; build network (i.e. the system module and its submodules recursively) insert starter messages for all submodules using activity() do callInitialize() on system module enter event loop // (described earlier) if (event loop terminated normally) // i.e. no errors do callFinish() on system module clean up Presentation_ID © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 39
  • 40. Simulation in pseudo code callInitialize() { call to user-defined initialize() function if( module is compound ) for (each submodule) do callInitialize() on submodule } callFinish() { if( module is compound ) for (each submodule) do callFinish() on submodule call to user-defined finish() function } Presentation_ID © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 40
  • 41. Event loop in more detail while ( FES not empty and simulation not yet complete ) { retreive first event from FES t := timestamp of this event m := module containing this event if ( m works with handleMessage() ) m->handleMessage(event) else // m works with activity() transferTo(m) } Presentation_ID © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 41
  • 42. activity() vs handleMessage()  activity(), implemented using fiber in win32, coding more or less like multi-thread, simple, but consume more memory usage(stack), bad coding style. Not recommendate.  handleMessage(), messaged-based, event-driver. Presentation_ID © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 42
  • 43. Message processing in handleMessage()  Send()  ScheduleAt()  CancelEvent()  DO NOT use receive() and wait(), they’re used in activity() Presentation_ID © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 43
  • 44. Simple Module example class Generator : public cSimpleModule { public: Generator(): cSimpleModule() {} protected: virtual void initialize(); virtual void handleMessage(cMessage *msg); } Define_Module(Generator); Presentation_ID © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 44
  • 45. Simple Module example void Generator::initialize() { // schedule first sending scheduleAt(simTime(), new cMessage); } void Generator::handleMessage(cMessage* msg) { // generate & send packet cMessage * pkt = new cMessage; send(pkt, "out"); // schedule next call scheduleAt(simTime() + exponential(1.0), msg); } Presentation_ID © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 45
  • 46. Message definition  setter and getter  reflection provided for messages(just like java)  Compiled into .h and .cc files  Can be used to define message and packets Presentation_ID © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 46
  • 47. Steps for application 1. Create a working directory called tictoc. 2. Describe your example network by creating a topology file(*.ned). 3. We now need to implement the functionality of the simple module(*.cc). 4. We now create the Makefile which will help us to compile and link our program to create the executable tictoc: $ opp_makemake 5. Compile and link our very first simulation by making command: $ make 6.you have to create one. omnetpp.ini tells the simulation program which network you want to simulate 7. Once you complete the above steps, you launch the simulation. Presentation_ID © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 47
  • 48. Building and running simulation Presentation_ID © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 48
  • 49. Tic-toc example: tictoc1.ned Presentation_ID © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 49
  • 50. Tic-toc example: txc1.cc Presentation_ID © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 50
  • 51. Tic-toc example: txc1.cc Presentation_ID © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 51
  • 52. One-hop simulation Presentation_ID © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 52
  • 53. Q and A Presentation_ID © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 53