qualnet tutorial - external

Upload: nada-saif

Post on 03-Jun-2018

228 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/12/2019 Qualnet Tutorial - External

    1/20

    Qualnet

    Hwee-Xian [email protected]

    15th August 2005

    mailto:[email protected]:[email protected]
  • 8/12/2019 Qualnet Tutorial - External

    2/20

    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

    http://www.qualnet.com/training_and_support/support/forums/index.phphttp://www.qualnet.com/training_and_support/support/forums/index.php
  • 8/12/2019 Qualnet Tutorial - External

    3/20

    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 xvfzfilename

    Copy the license file

    home_directory/qualnet/3.8/license_dir

  • 8/12/2019 Qualnet Tutorial - External

    4/20

    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

  • 8/12/2019 Qualnet Tutorial - External

    5/20

    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

  • 8/12/2019 Qualnet Tutorial - External

    6/20

    File OrganizationSubdirectory Description

    QUALNET_HOME/addons Optional or alternative features

    QUALNET_HOME/application Code for the application layer protocols

    QUALNET_HOME/bin Executable, configuration and input/output files (.stat)

    QUALNET_HOME/gui Visual environment toolset

    QUALNET_HOME/include Common include files

    QUALNET_HOME/lib Runtime library files for the GUI

    QUALNET_HOME/main Core files

    QUALNET_HOME/network Code for the Network layer and routing protocolsQUALNET_HOME/phy Code for the radio and related propagation models

    QUALNET_HOME/transport Code for the transport layer protocols

    QUALNET_HOME/mac Code for the MAC layer protocols

  • 8/12/2019 Qualnet Tutorial - External

    7/20

    Modeling Protocols in Qualnet

    Initialization

    Finalization

    Wait for event

    Event 1 Handler Event 2 Handler

    Event dispatcher

  • 8/12/2019 Qualnet Tutorial - External

    8/20

    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 layersor 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

  • 8/12/2019 Qualnet Tutorial - External

    9/20

    Packet EventsAPP APPMSG_Alloc( )

    MSG_PktAlloc( )MSG_Send( )

    MSG_Free( )

    Transport TransportMSG_RemoveHdr( )MSG_Send( )

    MSG_AddHdr( )MSG_Send( )

    IP / Routing IPMSG_AddHdr( )MSG_Send( )

    MSG_RemoveHdr( )MSG_Send( )

    MAC MACMSG_RemoveHdr( )MSG_Send( )MSG_AddHdr( )MSG_Send( )

    PHY PHY

  • 8/12/2019 Qualnet Tutorial - External

    10/20

    Timer Events

    Message *newMsg;clocktype delay;newMsg = MESSAGE_Alloc(node,

    LAYER_NAME,

    PROTOCOL_NAME,EVENT_TYPE);

    delay = 5*SECOND;MESSAGE_Send(node, newMsg, delay);

    Examples of usage:

    Periodic routing updates

    Periodic broadcasts

  • 8/12/2019 Qualnet Tutorial - External

    11/20

    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

  • 8/12/2019 Qualnet Tutorial - External

    12/20

    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

  • 8/12/2019 Qualnet Tutorial - External

    13/20

    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, TRANSPORTlayer, APPLICATION layer

    Statistics, Traces

  • 8/12/2019 Qualnet Tutorial - External

    14/20

    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

    http://www.qualnet.com/products/developer/model_specs.phphttp://www.qualnet.com/products/developer/model_specs.php
  • 8/12/2019 Qualnet Tutorial - External

    15/20

    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?

  • 8/12/2019 Qualnet Tutorial - External

    16/20

    Adding Protocols in Qualnetnew_protocol.h

    (header file)

    #define variablesFunction declarationsData structuresType enumeration#include statements

    FunctionsInitializationHandleProtocolEventHandleProtocolPacketFinalization

    new_protocol.cpp

    network.cpp in ~/networkmac.cpp in ~/mac

    ProcessEventmain file in each layer

    Makefile-common (in ~/main)

  • 8/12/2019 Qualnet Tutorial - External

    17/20

    Qualnet Animator Requirements:

    Java SDK 2 or higher with Netbeans support

    Visual Studio 6

    X-terminal software

    Go to ~/gui/netbeans/bin ./runide.sh

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

    Press PLAY to start the simulation

  • 8/12/2019 Qualnet Tutorial - External

    18/20

    Tracing data TRACER Trace options in ~/bin/default.config

    # PACKET-TRACE YES | NO# TRACE-TRANSPORT-LAYER YES | NO# TRACE-NETWORK-LAYER YES | NO

    # TRACE-DIRECTION INPUT | OUTPUT | BOTH

    # TRACE-ALL YES | NO# TRACE-TCP YES | NO

    # TRACE-UDP YES | NO# TRACE-IP YES | NO# TRACE-OSPFv2 YES | NO

  • 8/12/2019 Qualnet Tutorial - External

    19/20

    Sample Trace File1,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.) = 1, 1

    Simulation time = 0.010888503

    Id of node processing that packet = 1

    Id of originating protocol = 46Protocols ids with hdr description = 1, 2

    Header field values for protocol id 1 = 698,698,24,0

    Header field values for protocol id 2 = 4,5,48,44,0,000,0,64,17,0,1,4294967295

    Payload = null (no value)

  • 8/12/2019 Qualnet Tutorial - External

    20/20

    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