Anda di halaman 1dari 20

Qualnet

Hwee-Xian Tan stuhxt@i2r.a-star.edu.sg 15th August 2005

What is Qualnet?
Network simulator Commercial version of GloMoSim Discrete event simulator Allows simulation of both wired and wireless links Qualnet community forum @
http://www.qualnet.com/training_and_support/support/forums/index.php

Installation
For Windows
qualnet-3.8-university-MANET-QoS-windows.exe

For Linux or other Unixes


qualnet-3.8-university-MANET-QoS.tar.gz

License file Unzip the tar file from the home directory
tar xvfz filename

Copy the license file


home_directory/qualnet/3.8/license_dir

Installation
Edit shell startup script:
QUALNET_HOME=/home-directory/qualnet/3.8; export QUALNET_HOME PATH=$PATH:/home-directory/qualnet/3.8/gui/bin export PATH

Go to ~/qualnet/3.8/main
cp Makefile-redhat-9 Makefile make

Go to ~/qualnet/3.8/bin
./qualnet default.config

Installation
Possible error: Invalid (inconsistent) license key Get the hostname of your workstation:
hostname

IF localhost is reported:
hostname my-hostname

Get IP address of your workstation:


ifconfig

Open the file: /etc/hosts


127.0.0.1 localhost.localdomain localhost ip-address my-hostname.localdomain my-hostname

File Organization
Subdirectory QUALNET_HOME/addons QUALNET_HOME/bin QUALNET_HOME/gui QUALNET_HOME/include QUALNET_HOME/lib QUALNET_HOME/mac QUALNET_HOME/main QUALNET_HOME/network QUALNET_HOME/phy QUALNET_HOME/transport Description Optional or alternative features Executable, configuration and input/output files (.stat) Visual environment toolset Common include files Runtime library files for the GUI Code for the MAC layer protocols Core files Code for the Network layer and routing protocols Code for the radio and related propagation models Code for the transport layer protocols QUALNET_HOME/application Code for the application layer protocols

Modeling Protocols in Qualnet


Initialization Event dispatcher Wait for event Event 1 Handler Event 2 Handler

Finalization

Events and Messages


Message / Events
Data structure used to represent an event Holds information on event type and associated data

Types of events:
Packet events simulate exchange of data packets between layers or between nodes (i.e.: communication between different entities at same level) Timer events simulate time-outs; internal to a protocol

Message structure is defined in ~/addons/seq/message.h Event types are listed in ~/include/api.h

Packet Events
MSG_Alloc( ) MSG_PktAlloc( ) MSG_Send( ) MSG_AddHdr( ) MSG_Send( )

APP Transport IP / Routing

APP
MSG_Free( )

Transport
MSG_RemoveHdr( ) MSG_Send( )

IP
MSG_RemoveHdr( ) MSG_Send( )

MSG_AddHdr( ) MSG_Send( )

MAC
MSG_AddHdr( ) MSG_Send( )

MAC
MSG_RemoveHdr( ) MSG_Send( )

PHY

PHY

Timer Events
Examples of usage:
Periodic routing updates Periodic broadcasts
Message *newMsg; clocktype delay; newMsg = MESSAGE_Alloc(node, LAYER_NAME, PROTOCOL_NAME, EVENT_TYPE); delay = 5*SECOND; MESSAGE_Send(node, newMsg, delay);

Qualnet Simulator Architecture


Initialization
~/addons/seq/partition.cpp FUNCTION: PARTITION_InitializeNodes

Event Handling
~/addons/seq/node.cpp Determines layer which event has occurred Calls event dispatcher for appropriate layer E.g.: NODE_ProcessEvent calls APP_ProcessEvent APP_ProcessEvent determines protocol type and handles it accordingly

Finalization
Prints statistics

Running Simulations
Compile the Makefile in ~/main
make clean make

Modify the default.config in ~/bin


Simulation parameters to be specified in this file May have to modify NODE-POSITION-FILE file (default.nodes) to specify position and/or mobility

Modify the default.app in ~/bin


Traffic load and patterns to be specified in this file

Run the executable file


./qualnet default.config

Analyze the default.stats in ~/bin

Simulation Parameters
Simulation time Seed number Terrain dimensions Number of nodes Node placement (random, uniform, file, ) Mobility (group, random waypoint, ) Propagation pathloss model Fading model, shadowing model PHY layer, MAC layer, NETWORK layer, TRANSPORT layer, APPLICATION layer Statistics, Traces

Models Available in Qualnet


Application Layer CBR, FTP, HTTP, MCBR, TELNET, VBR, VoIP Transport Layer TCP, UDP Multicast DVMRP, MOSPF, ODMRP, PIM-DM Queuing FIFO, RED, RIO, WRED Scheduling CBQ, Round Robin, WFQ, WRR Routing AODV, DSR, Fisheye, LANMAR, LAR, OLSR, OSPFv2, STAR, ZRP MAC Aloha, CSMA, MACA, TDMA, IEEE 802.11 Antenna Omnidirectional, Steerable beam, Switched beam Pathloss Free space, Pathloss matrix, 2-ray Shadowing Log-normal Fading Rayleigh, Ricean Modulation BPSK, DPSK, FEC Mobility Group mobility, Random waypoint, Trace-based mobility http://www.qualnet.com/products/developer/model_specs.php

Adding Protocols in Qualnet


Things to consider:
What layer does it sit in? (APP, TRANSPORT, NETWORK, MAC, PHY) What messages to include?
Event messages Packet types

What other layers does it interact with?


E.g.: Routing layer usually interacts with the transport layer and the MAC layer.

Data structures
What are the data structures to be maintained? Where should they be stored? Where will they be accessed?

Adding Protocols in Qualnet


new_protocol.h (header file)
#include statements Functions Initialization HandleProtocolEvent HandleProtocolPacket Finalization #define variables Function declarations Data structures Type enumeration

new_protocol.cpp
network.cpp in ~/network mac.cpp in ~/mac ProcessEvent

main file in each layer

Makefile-common (in ~/main)

Qualnet Animator
Requirements:
Java SDK 2 or higher with Netbeans support <windows> Visual Studio 6 <unix server> X-terminal software

<unix> Go to ~/gui/netbeans/bin
./runide.sh

Build the scenario (similar to default.config) Press the RUN button Press PLAY to start the simulation

Tracing data
TRACER Trace options in ~/bin/default.config # PACKET-TRACE # TRACE-TRANSPORT-LAYER # TRACE-NETWORK-LAYER # TRACE-DIRECTION # TRACE-ALL # TRACE-TCP # TRACE-UDP # TRACE-IP # TRACE-OSPFv2 YES | NO YES | NO YES | NO INPUT | OUTPUT | BOTH YES | NO YES | NO YES | NO YES | NO YES | NO

Sample Trace File


1,1;0.010888503;1;46;1,2;698,698,24,0;4,5,48,44,0,000,0,64,17,0,1,4294967295

Packet id (source node id, seq. no.) Simulation time Id of node processing that packet Id of originating protocol Protocols ids with hdr description Header field values for protocol id 1 Header field values for protocol id 2 Payload

= 1, 1 = 0.010888503 =1 = 46 = 1, 2 = 698,698,24,0 = 4,5,48,44,0,000,0,64,17,0,1,4294967295 = null (no value)

Additional
Duplicate a copy of the original files Keep a log of changes to files
Enclose modified codes with commented tags

Practise good programming habits:


Use #define variable-name instead of hard-coding variables Use #ifdef statements for conditional components

Code with flexibility in mind


Read input parameters from file during initialization

Anda mungkin juga menyukai