1 / 20

OMNeT ++

OMNeT ++. Outline. Introduction Overview The NED Language Simple Modules. What Is OMNeT ++?. Object-oriented modular discrete event network simulation framework modeling of wired and wireless communication networks protocol modeling modeling of queueing networks

jenaya
Download Presentation

OMNeT ++

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. OMNeT++

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

  3. What Is OMNeT++? • 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

  4. What Is OMNeT++? • 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)

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

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

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

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

  9. The NED Language • A communication network

  10. Defines a network //Net6.ned network Network { submodules: node1: Node; node2: Node; node3: Node; ... connections: node1.port++ <--> {datarate=100Mbps;} <--> node2.port++; node2.port++ <--> {datarate=100Mbps;} <--> node4.port++; node4.port++ <--> {datarate=100Mbps;} <--> node6.port++; ... } //omnetpp.ini [General] network = Network new gate

  11. Introducing a Channel network Network { types: channel C extends ned.DatarateChannel { datarate = 100Mbps; } submodules: node1: Node; node2: Node; node3: Node; ... connections: node1.port++ <--> C <--> node2.port++; node2.port++ <--> C <--> node4.port++; node4.port++ <--> C <--> node6.port++; ... }

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

  13. The Node Compound Module module Node { parameters: int address; @display("i=misc/node_vs,gold"); gates: inout port[]; submodules: app: App; routing: Routing; queue[sizeof(port)]: Queue; connections: routing.localOut --> app.in; routing.localIn <-- 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]; } } size will be determined implicitly by the number of neighbours bidirectional connections

  14. Simple Modules • Simple modules are programmed in C++, using the OMNeT++ 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.)

  15. Components, Simple Modules, Channels

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

  17. handleMessage() • send() family of functions • to send messages to other modules • scheduleAt() • to schedule an event (the module “sends a message to itself”) • cancelEvent() • to delete an event scheduled with scheduleAt() • Cannot use the receive() and wait() functions

  18. Protocol Models class FooProtocol : public cSimpleModule { protected: // state variables // ... virtual void processMsgFromHigherLayer(cMessage *packet); virtual void processMsgFromLowerLayer(FooPacket *packet); virtual void processTimer(cMessage *timer); virtual void initialize(); virtual void handleMessage(cMessage *msg); }; // ... void FooProtocol::handleMessage(cMessage *msg) { if (msg->isSelfMessage()) processTimer(msg); else if (msg->arrivedOn("fromNetw")) processMsgFromLowerLayer(check_and_cast<FooPacket *>(msg)); else processMsgFromHigherLayer(msg); }

  19. 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 • scheduleAt() • to schedule an event (the module “sends a message to itself”) • cancelEvent() • to delete an event scheduled with scheduleAt() • end() • to finish execution of this module (same as exiting the activity() function)

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

More Related