40
OPNET TM Modeler CS 541 Advanced Networking Spring 2009

OPNET TM Modeler CS 541 Advanced Networking Spring 2009

Embed Size (px)

Citation preview

Page 1: OPNET TM Modeler CS 541 Advanced Networking Spring 2009

OPNETTM ModelerCS 541

Advanced Networking

Spring 2009

Page 2: OPNET TM Modeler CS 541 Advanced Networking Spring 2009

Outline

Getting Started Implement Custom Protocols Wireless Network Issues Debugging

Page 3: OPNET TM Modeler CS 541 Advanced Networking Spring 2009

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

Page 4: OPNET TM Modeler CS 541 Advanced Networking Spring 2009

Getting Started

Modeler Tutorials: [Help - Tutorials] Go through all of them

Module Tutorials Creating a Wireless Network

Page 5: OPNET TM Modeler CS 541 Advanced Networking Spring 2009

General Simulation Steps

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

Page 6: OPNET TM Modeler CS 541 Advanced Networking Spring 2009

OPNET Object Hierarchy

Page 7: OPNET TM Modeler CS 541 Advanced Networking Spring 2009

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

Page 8: OPNET TM Modeler CS 541 Advanced Networking Spring 2009

Implement Custom Protocols

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

Page 9: OPNET TM Modeler CS 541 Advanced Networking Spring 2009

MANET routing protocols

Page 10: OPNET TM Modeler CS 541 Advanced Networking Spring 2009

Node Model: manet_station_adv

Page 11: OPNET TM Modeler CS 541 Advanced Networking Spring 2009
Page 12: OPNET TM Modeler CS 541 Advanced Networking Spring 2009

Process Model: manet_mgr

Page 13: OPNET TM Modeler CS 541 Advanced Networking Spring 2009

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

Page 14: OPNET TM Modeler CS 541 Advanced Networking Spring 2009

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

Page 15: OPNET TM Modeler CS 541 Advanced Networking Spring 2009

OPNET Wireless Suite

Pipeline Stages Node Mobility Antenna Pattern Terrain Effects

Page 16: OPNET TM Modeler CS 541 Advanced Networking Spring 2009

Understand Pipeline Stages

Pipeline – sequence of calculations

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

Page 17: OPNET TM Modeler CS 541 Advanced Networking Spring 2009

Radio Pipeline Stages (Tx side)

1. Receiver Group

2. Transmission Delay

3. Link Closure

4. Channel Match

5. Tx Antenna Gain

6. Propagation Delay

Page 18: OPNET TM Modeler CS 541 Advanced Networking Spring 2009

Radio Pipeline Stages (Rx side)

7. Rx Antenna Gain8. Received Power9. Interference Noise10. Background Noise11. Signal-to-Noise Ratio12. Bit Error Rate13. Error Allocation14. Error Correction

Page 19: OPNET TM Modeler CS 541 Advanced Networking Spring 2009

Default Pipeline Stages

Default stages <opnet_dir>/<rel_dir>/models/std/links <opnet_dir>/<rel_dir>/models/std/wireless

Default stage prefixes dpt_* - default point-to-point dbu_* - default bus dra_* - default radio

Page 20: OPNET TM Modeler CS 541 Advanced Networking Spring 2009

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

Page 21: OPNET TM Modeler CS 541 Advanced Networking Spring 2009

Assign Pipeline Stage to Module

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

Page 22: OPNET TM Modeler CS 541 Advanced Networking Spring 2009

Skip Pipeline Stages

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

Page 23: OPNET TM Modeler CS 541 Advanced Networking Spring 2009

Modeling Node Mobility

4 methods: Use trajectory files Specify a “motion vector” via attributes Random Waypoint Model Update node position programmatically

Page 24: OPNET TM Modeler CS 541 Advanced Networking Spring 2009

Trajectory Files

Path of a mobile node during a simulation in a text file (.trj)

Absolute / relative positions

Page 25: OPNET TM Modeler CS 541 Advanced Networking Spring 2009

Motion Vector

Move along a great circle around the earth Bearing / ground speed / ascent rate

(advanced attributes)

Page 26: OPNET TM Modeler CS 541 Advanced Networking Spring 2009

Random Waypoint

Node moves randomly from one waypoint to another

Trajectoryrecording

Page 27: OPNET TM Modeler CS 541 Advanced Networking Spring 2009

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 ()

Page 28: OPNET TM Modeler CS 541 Advanced Networking Spring 2009

Antenna Modeling

Antenna Pattern Editor Visualize pattern in 3D Specify gains (φ, θ) Normalization

Consult Naraj

Page 29: OPNET TM Modeler CS 541 Advanced Networking Spring 2009

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

Page 30: OPNET TM Modeler CS 541 Advanced Networking Spring 2009

Find and Install Terrain Data

DTED files .dt0, .dt1, .dt2

USGS DEM files .dem

Page 31: OPNET TM Modeler CS 541 Advanced Networking Spring 2009

Display Elevation Maps

•.el files, can be generated by OPNET using terrain data

Page 32: OPNET TM Modeler CS 541 Advanced Networking Spring 2009

Select a Propagation Model

Page 33: OPNET TM Modeler CS 541 Advanced Networking Spring 2009

Debugging

Strategy Select Kernel ODB C/C++ Debugger

Page 34: OPNET TM Modeler CS 541 Advanced Networking Spring 2009

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)

Page 35: OPNET TM Modeler CS 541 Advanced Networking Spring 2009

Simulation Kernels

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

Optimized Kernels Use for production

Page 36: OPNET TM Modeler CS 541 Advanced Networking Spring 2009

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

Page 37: OPNET TM Modeler CS 541 Advanced Networking Spring 2009

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

Page 38: OPNET TM Modeler CS 541 Advanced Networking Spring 2009

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

Page 39: OPNET TM Modeler CS 541 Advanced Networking Spring 2009

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

Page 40: OPNET TM Modeler CS 541 Advanced Networking Spring 2009

Questions?