OMNET Outline Introduction Overview The NED Language Simple

  • Slides: 20
Download presentation
OMNET++

OMNET++

Outline • Introduction • Overview • The NED Language • Simple Modules

Outline • Introduction • Overview • The NED Language • Simple Modules

What Is OMNe. T++? • Object-oriented modular discrete event network simulation framework • modeling

What Is OMNe. T++? • Object-oriented modular discrete event network simulation framework • modeling of wired and wireless communication networks • protocol modeling • modeling of queueing networks • modeling of multiprocessors and other distributed hardware systems • validating of hardware architectures • evaluating performance aspects of complex software systems

What Is OMNe. T++? • Object-oriented modular discrete event network simulation framework • Components

What Is OMNe. T++? • Object-oriented modular discrete event network simulation framework • Components (modules) are programmed in C++ • Assembled into larger components and models using a high-level language (NED)

Modeling Concepts Gates • Input and output interfaces Connection • Spanning hierarchy levels are

Modeling Concepts Gates • Input and output interfaces Connection • Spanning hierarchy levels are not permitted • Propagation delay, data rate and bit error rate, can be assigned

Main features • Hierarchical Modules • Top level module is the system module •

Main features • Hierarchical Modules • Top level module is the system module • Depth of module nesting is unlimited • Model structure is described in OMNe. T++'s NED language • User implements the simple modules in C++, using the OMNe. T++ simulation class library • Module Types • Both simple and compound modules are instances of module types

Main features • Messages • Modules communicate by exchanging messages • Frames or packets

Main features • Messages • Modules communicate by exchanging messages • Frames or packets in a computer network • Jobs or customers in a queuing network • Gates • Input and output interfaces of modules • messages are sent out through output gates and arrive through input gates • Links (connection) • Created within a single level of the module hierarchy

Main features • Modeling of Packet Transmissions • Data rate, propagation delay, bit error

Main features • Modeling of Packet Transmissions • Data rate, propagation delay, bit error rate and packet error rate • Parameters • Can be assigned in either the NED files or the configuration file omnetpp. ini • Used to customize simple module behavior, and to parameterize the model topology • Topology Description Method • User defines the structure of the model in NED language descriptions

The NED Language • A communication network

The NED Language • A communication network

Defines a network //Net 6. ned network Network { submodules: node 1: Node; node

Defines a network //Net 6. ned network Network { submodules: node 1: Node; node 2: Node; node 3: Node; new gate . . . connections: node 1. port++ <--> {datarate=100 Mbps; } <--> node 2. port++; node 2. port++ <--> {datarate=100 Mbps; } <--> node 4. port++; node 4. port++ <--> {datarate=100 Mbps; } <--> node 6. port++; . . . } //omnetpp. ini [General] network = Network

Introducing a Channel network Network { types: channel C extends ned. Datarate. Channel {

Introducing a Channel network Network { types: channel C extends ned. Datarate. Channel { datarate = 100 Mbps; } submodules: node 1: Node; node 2: Node; node 3: Node; . . . connections: node 1. port++ <--> C <--> node 2. port++; node 2. port++ <--> C <--> node 4. port++; node 4. port++ <--> C <--> node 6. port++; . . . }

The App, Routing, and Queue Simple Modules simple App { parameters: int dest. Address;

The App, Routing, and Queue Simple Modules simple App { parameters: int dest. Address; . . . @display("i=block/browser"); gates: sending and receiving application packets input in; output out; } simple Routing { . . . } simple Queue { . . . } App. ned, Routing. ned and Queue. ned

The Node Compound Module module Node { parameters: int address; @display("i=misc/node_vs, gold"); gates: size

The Node Compound Module module Node { parameters: int address; @display("i=misc/node_vs, gold"); gates: size will be determined implicitly by the number of neighbours inout port[]; submodules: bidirectional connections app: App; routing: Routing; queue[sizeof(port)]: Queue; connections: routing. local. Out --> app. in; routing. local. In <-- app. out; for i=0. . sizeof(port)-1 { routing. out[i] --> queue[i]. in; routing. in[i] <-- queue[i]. out; queue[i]. line <--> port[i]; } }

Simple Modules • Simple modules are programmed in C++, using the OMNe. T++ class

Simple Modules • Simple modules are programmed in C++, using the OMNe. T++ class library • Discrete Event Simulation • start of a packet transmission • end of a packet transmission • expiry of a retransmission timeout 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) } finish simulation (write statistical results, etc. )

Components, Simple Modules, Channels

Components, Simple Modules, Channels

Defining Simple Module Types // file: Hello. Module. cc #include <omnetpp. h> // file:

Defining Simple Module Types // file: Hello. Module. cc #include <omnetpp. h> // file: Hello. Module. ned simple Hello. Module { gates: input in; } class Hello. Module : public c. Simple. Module { protected: virtual void initialize(); virtual void handle. Message(c. Message *msg); }; // register module class with `opp` Define_Module(Hello. Module); void Hello. Module: : initialize() { ev << "Hello World!n"; } called for every message that arrives at the module void Hello. Module: : handle. Message(c. Message *msg) { delete msg; // just discard everything we receive }

handle. Message() • send() family of functions • to send messages to other modules

handle. Message() • send() family of functions • to send messages to other modules • schedule. At() • to schedule an event (the module “sends a message to itself”) • cancel. Event() • to delete an event scheduled with schedule. At() • Cannot use the receive() and wait() functions

Protocol Models class Foo. Protocol : public c. Simple. Module { protected: // state

Protocol Models class Foo. Protocol : public c. Simple. Module { protected: // state variables //. . . virtual void process. Msg. From. Higher. Layer(c. Message *packet); virtual void process. Msg. From. Lower. Layer(Foo. Packet *packet); virtual void process. Timer(c. Message *timer); virtual void initialize(); virtual void handle. Message(c. Message *msg); }; //. . . void Foo. Protocol: : handle. Message(c. Message *msg) { if (msg->is. Self. Message()) process. Timer(msg); else if (msg->arrived. On("from. Netw")) process. Msg. From. Lower. Layer(check_and_cast<Foo. Packet *>(msg)); else process. Msg. From. Higher. Layer(msg); }

activity() • receive() • to receive messages (events) • wait() • to suspend execution

activity() • receive() • to receive messages (events) • wait() • to suspend execution for some time (model time) • send() family of functions • to send messages to other modules • schedule. At() • to schedule an event (the module “sends a message to itself”) • cancel. Event() • to delete an event scheduled with schedule. At() • end() • to finish execution of this module (same as exiting the activity() function)

activity() void Sink: : activity() { while(true) { msg = receive(); delete msg; }

activity() void Sink: : activity() { while(true) { msg = receive(); delete msg; } }