Download as ppt, pdf, or txt
Download as ppt, pdf, or txt
You are on page 1of 40

OPNETTM Modeler

CS 541
Advanced Networking
Spring 2009

Outline

Getting Started
Implement Custom Protocols
Wireless Network Issues
Debugging

Introduction

OPNET (www.opnet.com)
Discrete time simulation
Shipped with lots of models written in
C
Platform: Windows/Linux
Programming Languages: C/C++
GUI/command line simulation

Getting Started

Modeler Tutorials: [Help - Tutorials]

Go through all of them

Module Tutorials

Creating a Wireless Network

General Simulation Steps

Create network scenario(s)


Configure nodes
Create traffic
Configure/run simulation
Choose statistics
Configure/run simulation
View results (Export data)

OPNET Object Hierarchy

Communication Entities

Packets

Inter/intra node communication


Recursively organized
Structure vs. Physical Layout

ICI (Interface Control Information)

Within a node, between different


layers/process models

Implement Custom
Protocols

Create new process models


Modify existing process models
Create new packet formats
Create/modify node models

MANET routing protocols

Node Model:
manet_station_adv

Process Model: manet_mgr

Create a New Process Model

Easier to copy and modify on exist


model
Modifications:

The FSM (finite state machine)


State variables
Header/Function/ blocks, excecutives
External files (.h, .ex.c, .ex.cpp)

Add/modify attributes: model/global


Add/modify statistics: local/global

Add Support for New Model

Modify corresponding .h files, adding


constants and enums
Declare pf_rte as child process of
manet_mgr
Modify manet_mgr model:

Add attributes for pf_rte


Add code to create and invoke pf_rte
process
Add code to dispatch packets to pf_rte

Use text search tools to help

OPNET Wireless Suite

Pipeline Stages
Node Mobility
Antenna Pattern
Terrain Effects

Understand Pipeline Stages

Pipeline sequence of calculations


Point-to-Point Pipeline Models
Bus Pipeline Models
Radio Pipeline Models

Radio Pipeline Stages (Tx


side)
1.
2.
3.
4.
5.
6.

Receiver Group
Transmission Delay
Link Closure
Channel Match
Tx Antenna Gain
Propagation Delay

Radio Pipeline Stages (Rx


side)
7.
8.
9.
10.
11.
12.
13.
14.

Rx Antenna Gain
Received Power
Interference Noise
Background Noise
Signal-to-Noise Ratio
Bit Error Rate
Error Allocation
Error Correction

Default Pipeline Stages

Default stages

<opnet_dir>/<rel_dir>/models/std/links
<opnet_dir>/<rel_dir>/models/std/wirel
ess

Default stage prefixes

dpt_* - default point-to-point


dbu_* - default bus
dra_* - default radio

Customize Pipeline Stages

Write own <name>.ps.c /


<name>.ps.cpp
Interface: void pipeline_stage (Packet
*);
Compilation

GUI compile button


CMD op_mko -type ps -m <name>
Generate <name>.ps.o / <name>.ps.obj

Assign Pipeline Stage to


Module
In node model,
set the
attributes of
radio transmitter
or receiver
objects
An attribute for
each pipeline
stage

Skip Pipeline Stages

To speed up simulations
Set the pipeline stage attribute to
NONE
A fixed pre-determined value will be
used.

Modeling Node Mobility

4 methods:

Use trajectory files


Specify a motion vector via attributes
Random Waypoint Model
Update node position programmatically

Trajectory Files

Path of a mobile node during a


simulation in a text file (.trj)
Absolute / relative positions

Motion Vector

Move along a great circle around the


earth
Bearing / ground speed / ascent rate
(advanced attributes)

Random Waypoint

Node moves randomly from one


waypoint to another
Trajectory
recording

Mobility KPs

op_ima_obj_pos_get ()
op_ima_obj_pos_get_time ()
op_ima_obj_pos_notification_register
()
op_ima_obj_pos_query_proc_set ()
op_ima_obj_pos_set_geocentric ()
op_ima_obj_pos_set_geodetic ()

Antenna Modeling

Antenna Pattern Editor

Visualize pattern in 3D
Specify gains (, )
Normalization

Consult Naraj

Terrain Effects

Calculated in pipeline stage: Closure


Without TMM module:

LOS (Line Of Sight) with earth curve


considered

With TMM module:

Free space
Longley-Rice
TIREM

Find and Install Terrain Data

DTED files

.dt0, .dt1, .dt2

USGS DEM files

.dem

Display Elevation Maps

.el files, can be


generated by OPNET
using terrain data

Select a Propagation Model

Debugging

Strategy
Select Kernel
ODB
C/C++ Debugger

Debugging Strategy

Looking for clues:

Compiler warnings
DES Log
Error Log
OPNET Debugger (ODB)
Memory tracking
Animation and live statistics

Narrow down the problem

Time (simulation time, event#, packet#)


Location (node, module, process, code)

Simulation Kernels

Development Kernels

Allows ODB
OPNET Profiler
Detailed error messages
Slower simulation execution
Slightly higher memory usage

Optimized Kernels

Use for production

ODB Features

Graphical interface
Step through events
Breakpoints for specific

Event, time, module, process, packet

Trace Kernel Procedures (KPs)


Print out current status of simulation
entities
Print out memory usage statistics
Pass control to and from a C/C++ debugger

Make codes easy to debug

Prefer op_prg_odb_print<major/minor>
() over printf ().
Use op_sim_error () for errors.
Use FIN/FOUT/FRET in every function.

Helps OPNET to display the function call


stack

Write traces and label them.


Write diagnostic blocks

Only invoked in ODB

Use a C/C++ Debugger

Compiling a process model generates a


C/C++ file: <model_name>.pr.c or .cpp
Primary functions unchanged
Executives / transitions macros
Temporary variable block local
variables
State variables fields of a struct

var_name op_sv_ptr->var_name

Use a C/C++ Debugger with


ODB

Run the simulation with ODB enabled

The simulation stops before the first event

Attach the C/C++ debugger to the


simulation process
Set breakpoints in ODB or the C/C++
debugger
Continue from the C/C++ debugger
Continue in ODB

Questions?

You might also like