17
By Mohammed Amer Al- Batati 2012 OMNet++ Step by Step Part - 3

Tutorial 3 getting started with omnet

Embed Size (px)

Citation preview

Page 1: Tutorial 3   getting started with omnet

ByMohammed Amer Al-

Batati

2012

OMNet++

Step by Step

Part - 3

Page 2: Tutorial 3   getting started with omnet

Start the OMNet IDE:1. Lunch “mingwenv.cmd”2. Type: omnetpp

Getting Started

Page 3: Tutorial 3   getting started with omnet

Then you will be asked to select the workspace path.

Let’s create our own. (e.g.; C:\Myworkspace) Click ‘OK’

Getting Started - cont.

Page 4: Tutorial 3   getting started with omnet

OMNet IDE

MigrationTutorials

What's New

OverviewWorkbench

Page 5: Tutorial 3   getting started with omnet

An OMNeT++ model consists of modules that communicate with message passing.

Simple modules can be grouped into compound modules and so forth.

The number of hierarchy levels is unlimited.

Modeling Concepts

Page 6: Tutorial 3   getting started with omnet

Modeling Concepts - cont.

Gate(s)Input gate (receive data from)Output gate (send data from)

Connection (link)Modules communicate by exchanging messages. In an actual simulation, messages can representframes, packets , jobs, etc.

Page 7: Tutorial 3   getting started with omnet

Go to “Project Explorer” (Window-> Show View-> Project Explorer)

Right-Click-> New -> OMNet++ Project Name it (myproject) -> select empty project -

> Finish

Simple Example

Page 8: Tutorial 3   getting started with omnet

Right-Click on “myproject” -> New -> Simple Module

Name it (Node.ned) -> A simple module -> Finish

Create Your First Simple Node

Page 9: Tutorial 3   getting started with omnet

Double Click on “Node.ned”.A dual-mode (Design and Source) NED editor

is opened.

Modifying “Node.ned”

Page 10: Tutorial 3   getting started with omnet

Double Click on “Node.ned”.A dual-mode (Design and Source) NED editor

is opened.

Modifying “Node.ned”

Page 11: Tutorial 3   getting started with omnet

For now, let our Node with only two gates: input and output gates.

Use keyword “gates” followed by “:” to define gates.

Use keyword “input” for input gates.Use keyword “output” for output gates. Don’t forget semi-colons or to save your file.

Defining Gates

Page 12: Tutorial 3   getting started with omnet

Go back to “Design” view.By Right-click on Node module, you can

modify the module properties (e.g.; base, icon and polygon).

Let’s change the icon.

Defining Gates - cont.

Page 13: Tutorial 3   getting started with omnet

Let’s create a network with two nodes (node1 and node2) connected to each other.

Right-Click on “myproject” -> New -> Network

Name it (mynetwork.ned) -> An empty network -> Finish.

Still with NED editor, so it can be done using either Design or Source mode.

Creating a Network

Page 14: Tutorial 3   getting started with omnet

One click on module “Node” in ‘Submodules’.Another click on “mynetwork” to create first

node.Rename it if needed.Do the same with the other node.

Creating a Network – Design Mode

Page 15: Tutorial 3   getting started with omnet

Connect them together by using “Connection”, which can be founded in Palette.

There are three types of channels:

Activate “Connection” by clicking on it. Connect Node1 with Node2 by clicking

Node1 first then Node2. (From node1 to Node2)

Do the same with Node 2.

Creating a Network – Design Mode

Page 16: Tutorial 3   getting started with omnet

By opening the Source mode we will find:

Creating a Network – Source Mode

CTRL+SHIFT+OTo import needed packages.

CTRL+SHIFT+FTo reformat the NED file.

CTRL+SPACEWhen help is needed.

Page 17: Tutorial 3   getting started with omnet

let's test what we have done so far.Right-click on “mynetwork.ned” Run As ->

OMNet++ Simulator.

OK -> OK

Running The Experiments