Network Simulation with OMNet Ing Giuliana Alderisi Introduction

  • Slides: 27
Download presentation
Network Simulation with OMNet++ Ing. Giuliana Alderisi

Network Simulation with OMNet++ Ing. Giuliana Alderisi

Introduction OMNe. T++ is an open-source modular discrete event network simulator The simulator is

Introduction OMNe. T++ is an open-source modular discrete event network simulator The simulator is used for: • Modeling telecommunication networks • Modeling protocols for networks • Modeling queuing networks • Modeling multiprocessor and other distributed systems • Measuring performance of complex software systems • Other discrete event systems. . .

The OMNe. T++ approach OMNe. T++ is a simulation framework Provides an infrastructure for

The OMNe. T++ approach OMNe. T++ is a simulation framework Provides an infrastructure for writing such simulations, made up of: A library of C++ classes From which the user derives its own classes A discrete event simulation kernel Not to be changed by the user A user who wants to develop a simulator must Describe the simulation model Describe the parameterized simulation scenarios

Simulation Model A simulation model is described through the Network Description Language, in terms

Simulation Model A simulation model is described through the Network Description Language, in terms of: Modules Gates Connections Messages Hierarchically nested modules exchanging messages with each another The depth of modules nesting is not limited. This allows the user to reflect the logical structure of the actual system in the model structure.

Omnet++ Modules can be simple or composed Compound modules: Modules that contain submodules Simple

Omnet++ Modules can be simple or composed Compound modules: Modules that contain submodules Simple modules: contain the algorithms in the model, implemented in C++, using the OMNe. T++ simulation class library

Example Module Hierarchy Network interface card: a compound module consisting of a simple module

Example Module Hierarchy Network interface card: a compound module consisting of a simple module MAC and a compound module Phy

Messages Modules communicate by exchanging messages Messages can represent frames or packets in a

Messages Modules communicate by exchanging messages Messages can represent frames or packets in a computer network, or other logical elements (e. g. timers) Messages can contain arbitrarily complex data structures Messages can arrive from another module or from the same module (self-messages are used to implement timers) Simple modules can send messages either directly to their destination or along a predefined path, through gates and connections.

Gates are the input and output interfaces of modules: Messages are sent out through

Gates are the input and output interfaces of modules: Messages are sent out through output gates and arrive through input gates Each connection (also called link) is created within a single level of the module hierarchy: Within a compound module, one can connect the corresponding gates of two submodules, or a gate of one submodule and a gate of the compound module. Submodules connected to each other Submodules connected to the parent module

Connections can be assigned some parameters, which facilitate the modeling of communication networks: propagation

Connections can be assigned some parameters, which facilitate the modeling of communication networks: propagation delay bit error rate data rate One can specify link parameters individually for each connection, or define link types and use them throughout the whole model.

Implementation To implement a simulation model the user must provide: The. ned files which

Implementation To implement a simulation model the user must provide: The. ned files which describe the modules The. msg files which describe the messages The. h and. cc files which implements the simple modules behaviour The. ini file which contains the simulation parameters

The NEtwork Description language (NED) Components of a NED description: Import directives Channel definitions

The NEtwork Description language (NED) 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"; import inet. protocols. networklayer. ip. Routing. Table; // packages import inet. protocols. networklayer. ip. *; // wildcards import inet. protocols. networklayer. ip. Ro*Ta*; import inet. protocols. *. ip. *; import inet. **. Routing. Table;

Channel definitions Channels encapsulate parameters and behavior associated with connections. The predefined types are:

Channel definitions Channels encapsulate parameters and behavior associated with connections. The predefined types are: ned. Ideal. Channel No parameters ned. Delay. Channel Two parameters: delay. Disabled ned. Datarate. Channel. Three more parameters: datarate, per, ber New channel types can be defined by specializing the predefined ones

Channel definitions Examples: channel C extends ned. Datarate. Channel { datarate = 100 Mbps;

Channel definitions Examples: channel C extends ned. Datarate. Channel { datarate = 100 Mbps; delay = 100 us; ber = 1 e-10; } channel Datarate. Channel 2 extends ned. Datarate. Channel { double distance @unit(m); delay = this. distance / 200000 km * 1 s; }

Simple module definitions simple Traffic. Gen { parameters: interarrival. Time: double; num. Of. Messages

Simple module definitions simple Traffic. Gen { parameters: interarrival. Time: double; num. Of. Messages : int; address : string; gates: } in: from. Port, from. Higher. Layer; out: to. Port, to. Higher. Layer;

Compound module definitions module Compound. Module { types: //. . . parameters: //. .

Compound module definitions module Compound. Module { types: //. . . parameters: //. . . gates: //. . . submodules: //. . . connections: //. . . }

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

Compound module definitions: submodules module Compound. Module { //. . . submodules: submodule 1: Module. Type 1 { parameters: //. . . } submodule 2: Module. Type 2 { parameters: //. . . } }

Compound module definitions: submodules module Compound. Module { parameters: param 1: numeric, param 2:

Compound module definitions: submodules 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; //. . . }

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

Compound module definitions: connections module Compound. Module { parameters: //. . . gates: //. . . submodules: //. . . connections: node 1. output --> node 2. input node 1. input <-- node 2. output; node 1. inout <--> node 2. inout; //. . . }

Message definition Messages are a central concept in OMNe. T++. In the model, message

Message definition Messages are a central concept in OMNe. T++. In the model, message objects represent events, packets, commands, jobs, customers or other kinds of entities, depending on the model domain. Message definitions provide a very compact syntax to describe message contents. C++ code is automatically generated from message definitions, thus saving a lot of typing.

Message definition provided in mypacket. msg: The generated mypacket_m. h declares the following class:

Message definition provided in mypacket. msg: The generated mypacket_m. h declares the following class: In your C++ file, you could use the My. Packet class like this:

Message definition Data types for message fields can be: Primitive data types (bool, char,

Message definition Data types for message fields can be: Primitive data types (bool, char, int, long, double, string, etc. ) Enumerations Classes Structures Arrays It is also possible to use existing C++ types

c. Message class All the messages are derived from c. Message class Some useful

c. Message class All the messages are derived from c. Message class Some useful methods: msg->set. Kind( kind ); msg->set. Bit. Length( length ); msg->set. Byte. Length( length. In. Bytes ); msg->set. Bit. Error( err ); msg->set. Timestamp( simtime ); msg->dup(); //duplicates the message bool is. Self. Message(); bool is. Scheduled(); int k = msg->get. Kind(); int l = msg->get. Bit. Length(); int lb = msg>get. Byte. Length(); bool b = msg->has. Bit. Error(); simtime_t t = msg>get. Timestamp(); simtime_t get. Creation. Time(); simtime_t get. Sending. Time(); simtime_t get. Arrival. Time();

Recording simuation results The simulation may write output vector and output scalar files scenarioname.

Recording simuation results The simulation may write output vector and output scalar files scenarioname. vec and scenarioname. 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: Queue length over time, end-to-end delay of received packets, packet drops or channel throughput You can configure output vectors from omnetpp. ini 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

Recording simulation results Output vectors Output scalars

Recording simulation results Output vectors Output scalars

Domande?

Domande?

Per inziare… • Scaricare OMNet++ dal sito • Installare OMNet++ (come da manuale) Prima

Per inziare… • Scaricare OMNet++ dal sito • Installare OMNet++ (come da manuale) Prima di chiedere la tesina: • Seguire il tutorial (almeno il TIC TOC!!)