Documente Academic
Documente Profesional
Documente Cultură
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
modeling of multiprocessors and other distributed hardware
systems
validating of hardware architectures
evaluating performance aspects of complex software systems
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
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
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
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 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
Defines a network
//Net6.ned
network Network
{
submodules:
node1: Node;
node2: Node;
node3: Node;
new gate
...
connections:
node1.port++ <--> {datarate=100Mbps;} <--> node2.port++;
node2.port++ <--> {datarate=100Mbps;} <--> node4.port++;
node4.port++ <--> {datarate=100Mbps;} <--> node6.port++;
...
}
//omnetpp.ini
[General]
network = Network
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++;
...
}
Simple Modules
Simple modules are programmed in C++, using the
// file: HelloModule.ned
simple HelloModule
{
gates:
input in;
}
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
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);
}
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)
activity()
void Sink::activity()
{
while(true)
{
msg = receive();
delete msg;
}
}