1 / 108

QualNet Programmer’s Guide

QualNet Programmer’s Guide. UbiLab 2012. Index. Directory Structure QualNet Basic Message & Event QualNet simulation architecture Protocol Model Programming Application Layer Transport Layer Network Layer Queue & Scheduler.

Download Presentation

QualNet Programmer’s Guide

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. QualNetProgrammer’s Guide UbiLab 2012

  2. Index • Directory Structure • QualNet Basic • Message & Event • QualNet simulation architecture • Protocol Model Programming • Application Layer • Transport Layer • Network Layer • Queue & Scheduler ※ Detailed information are referred to QualNet Programmer’s Guide document.

  3. Directory structure

  4. Directory Structure global headers model sources & headers Qualnet kernel binaries & libraries

  5. Directory Structure

  6. qualnet basic

  7. Discrete Event Simulation Event Queue event1 • Event • arrival of packet • periodic alarm • Action • sending packet • updating system state • starting/restarting timer event2 … eventN register event event

  8. QualNet Protocol Stack • Layer Based Architecture & Organization • Events & Messages • Events: Essential Concepts • Lifecycle • Event Handling • Packets • Timers • API: Raw Message API and Layer Specific

  9. Protocol Stack • Layered architecture • Data moves from layer to layer • APIs were used • can skip layer whendata is transmitted

  10. Layer Function

  11. How to send packet Node 1 needs to send a packet to Node 2 message Node 1 Node 2 Event: Packet Received Packet Sent

  12. Message & event

  13. Message • Events are implemented using Message • HOME/include/message.h • HOME/include/main.h affect transmission time not affect transmission time

  14. Message APIs • HOME/include/message.h • HOME/main/message.cpp • MESSAGE_Alloc • MESSAGE_Free • MESSAGE_PacketAlloc • MESSAGE_AddInfo • MESSAGE_AddHeader • MESSAGE_RemoveHeader • MESSAGE_GetLayer • MESSAGE_GetProtocol • MESSAGE_GetEvent • MESSAGE_Send

  15. Event Type • Packet • exchange of data packet between layers or nodes • communication between entities at the same layer • Timer • act as a trigger • An event is identified by the following: • Node • Layer • Protocol • Event ID

  16. Packet Event • to simulate transmission of packets across the network • using packet field of Message structure • at each layer, packet header is attached/removed • to send packet to another layer, MESSAGE_Send()

  17. Timer Event • periodic alarms for event scheduling • trigger • the event types are defined in • HOME/include/api.h ★ The delay time 0 means “immediate event”.

  18. A node with • CBR application • AODV routing • 802.11 wireless HOME/main/node.cpp /partition.cpp Node HOME/libraries/developer/src/ application.cpp app_cbr.cpp transport.cpp transport_udp.cpp Protocols Layers network.cpp network_ip.cpp routing_aodv.cpp mac.cpp mac_dot11.cpp phy.cpp phy_802_11.cpp phy_connectivity.cpp HOME/libraries/wireless/src/

  19. QualNetEventQueue QualNet Kernel Which Node’s Event? MESSAGE Node / Layer / Protocol / Event node = 4 Node Which Layer’s Event? layerType = Transport 3 Application 1 Transport Which Protocol? 4 2 UDP Which Event? protocolType = UDP call event handler function Network LINK/MAC Physical

  20. qualnet simulation architecture

  21. QualNet Simulator Architecture • Initialization • Event Handling • Finalization ★ Each of these functions is performed hierarchically. Node Layer Protocol

  22. Protocol Life Cycle Three main functions that are called by Simulator: • Initialization • Called at Time 0 • Initialization of variables • Event Processing • Called as needed • Creation • Scheduling • Handling • Finalization • Called at end of simulation • Printing Statistics

  23. Protocol Life Cycle QualNet Event Handling: Packets, timers etc Initialization Function Message (Packet or Timer) Processing Function • Modify State Variables • Increment Local Statistics • Generate / Forward Packets QualNet FinalizationFunction

  24. Initialization • node creation & initialization • initialization of each layer, protocol • HOME/main/partition.cpp • /application.cpp • /mac.cpp • /network.cpp • /node.cpp • /transport.cpp

  25. Event Handling • call a dispatcher function of appropriate node, layer, protocol when a event occurs • handle & scheduling event, change system states

  26. Finalization • call finalization function for each protocol running at that layer • print the statistics to output • free all instances and terminate simulation

  27. CBR Example - Initialization init App Layer routing protocol init App Layer traffic generating protocol

  28. CBR Example – Event Handling

  29. CBR Example – Finalization

  30. Protocol model programming

  31. Application layer

  32. Application Layer • Traffic-generating Protocols • Routing Protocols

  33. Traffic Generators

  34. RoutingProtocols

  35. Application Layer Files

  36. Application Layer Data Structure(1) • HOME/include/application.h • AppType • lists of all Application Layer protocols

  37. Application Layer Data Structure(2) • AppInfo • contains information about an instance of an application • application state & statistics

  38. Application Layer Data Structure(3) • AppData • main data structure used by the Application Layer • contain AppInfo & AppType information

  39. Application Layer Data Structure(4) • AppTimer • Application Layer timer

  40. Application Layer APIs • Application to Transport (app_util.h / app_util.cpp) • Transport to Application (api.h)

  41. Adding an App-Protocol application.h app_myApp.h enum { myApp, } AppType; myApp_data_structure { } include application.cpp app_myApp.cpp myApp_Init() { register NewApp; init Timer; } myApp_ProcessEvent() { case myAppEvent1: case myAppEvent2: } myApp_Finalize() APP_InitializeApplications() { myApp_Init(); } APP_ProcessEvent() { myApp_ProcessEvent(); } APP_Finalize() { myApp_Finalize(); } register Application Layer Protocol Name register Event Handler api.h enum { myAppEvent1, myAppEvent2, } register Event Types

  42. transport layer

  43. Transport Layer • TCP • guaranteed delivery • congestion control • UDP • connectionless • RSVP-TE • control protocol at Transport Layer • QoS

  44. Transport Layer Files

  45. Transport Layer Data Structure • HOME/include/transport.h • Transport Layer protocol type definition • Transport Data structure

  46. APIs Application Layer HOME/main/app_util.cpp HOME/include/api.h Transport Layer HOME/libraries/developer/src/network_ip.cpp HOME/libraries/developer/src/network_ip.h Network Layer

  47. Adding an Trans-Protocol(1)

  48. Adding an Trans-Protocol(2) register protocol data transport.h trans_myProtocol.h myProtocol_data_structure { } PARTITION_Initialize() include transport.cpp trans_myProtocol.cpp myProtocol_Init() { register NewApp; init Timer; } myProtocol_ProcessEvent() { case myProtocolEvent1: case myProtocolEvent2: } myProtocol_Finalize() TRANSPORT_Initialize() { myProtocol_Init(); } TRANSPORT_ProcessEvent() { myProtocol_ProcessEvent(); } TRANSPORT_Finalize() { myProtocol_Finalize(); } register Transport Layer Protocol Name register Event Handler api.h enum { myProtocolEvent1, myProtocolEvent2, } register Event Types

  49. network layer

  50. Network Layer • Routing • determining the next hop & outgoing interface for a packet • Traffic Control • congestion & transmission rate control • Addressing • identifying nodes in network • Internetworking • interconnecting heterogeneous networks

More Related