qualnet 2014/05/13 602430017 尉遲仲涵. outline directory structure qualnet basic message &...

Post on 25-Dec-2015

236 Views

Category:

Documents

1 Downloads

Preview:

Click to see full reader

TRANSCRIPT

QualNet

2014/05/13602430017 尉遲仲涵

2

Outline

• Directory Structure

• QualNet Basic

• Message & Event

• QualNet simulation architecture

• Protocol Model Programming– Application Layer– Transport Layer– Network Layer– Queue & Scheduler

3

DIRECTORY STRUCTURE

4

Directory Structure

Qualnet kernel binaries & libraries

model sources & headers

global headers

5

Directory StructureDirectory Contains

addons Components developed as custom addons for specific customers

bin Executable and other runtime files such as DLLs

contributed Models contributed by QualNet or EXata customers.

data Data files for the Wireless library: antenna configurations, modulation schemes and sample terrain

documentation User Guide, release notes, etc.

gui Graphical components including icons, Java class files, and GUI configuration.

include QualNet or EXata kernel header files.

interfaces Code to interface QualNet or EXata to 3rd party tools or external networks, such as HLA, STK, or IP networks.

kernel QualNet or EXata kernel objects used during the build process.

lib 3rd party software libraries used during the build process.

libraries Source code for model libraries such as Developer, Multimedia & Enterprise, & Wireless.

license_dir License files and license libraries required for the build process.

main Kernel source files and Makefiles.

scenarios Sample scenarios.

6

QUALNET BASIC

7

Discrete Event Simulation

• Event– arrival of packet– periodic alarm

• Action– sending packet– updating system state– starting/restarting timer

event1event2

…eventN

event

Event Queue

regis-ter

event

Handle Event Take Action

Changing System State

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 when

data is transmitted

10

Layer FunctionApplication Transport Network Link/MAC Physical Communica-

tion Medium

traffic gen-eration

End-to-End data trans-mission

data for-warding

link trans-mission

bit level data transmis-sion to/from medium

signaling be-tween nodes

App-level routing

receive from App, for-ward to Network

queuing & scheduling between Transport and MAC layer

signal prop-agation model,environ-ments model

rely on Transport layer

include IP layer func-tion

path loss,fading,shadowing,

11

How to send packet

Node 1

Node 2

Node 1 needs to send a packet to Node 2

Packet SentEvent:

Packet Received

message

12

MESSAGE & EVENT

13

Message

• Events are implemented using Message– HOME/include/message.h– HOME/include/main.h

affect trans-mission 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/libraries/wireless/src/

HOME/libraries/devel-oper/src/

application.cpp

transport.cpp

network.cppnetwork_ip.cpp

mac.cpp

phy_connectivity.cpp

app_cbr.cpp

transport_udp.cpp

routing_aodv.cpp

mac_dot11.cpp

phy.cppphy_802_11.cpp

NodeHOME/main/node.cpp /partition.cpp

Layers P

roto

cols

19

NodeWhich Layer’s Event?

QualNet Ker-nel

Which Node’s Event?

1

2

3

4

node = 4

QualNet EventQueue

Application

TransportWhich Protocol?

Network

LINK/MAC

Physical

layerType= Transport

UDPWhich Event?

protocolType= UDP

call event handler function

MESSAGENode / Layer / Protocol / Event

20

QUALNET SIMULATION ARCHITECTURE

21

QualNet Simulator Architec-ture

• Initialization• Event Handling• Finalization

★ Each of these functions is performed hierarchically.

Node

Layer

Proto-col

22

Protocol Life CycleThree 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

Initialization Function

Message (Packet or Timer) Process-ing Function

FinalizationFunction

Event Han-dling:

Packets, timers etc

• Modify State Variables

• Increment Local Statistics

• Generate / Forward Pack-ets

QualNet

QualNet

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 appro-priate node, layer, protocol when a event occurs

• handle & scheduling event, change system states

26

Finalization

• call finalization function for each pro-tocol running at that layer

• print the statistics to output• free all instances and terminate sim-

ulation

27

Adding a Network Layer Unicast Routing Protocol

2011.05.16.

28

How To …

29

30

Register Protocol Name

• HONE/include/network.h

31

Register Protocol Administrative Distance value

• HOME/include/network.h

32

Defining Data Structure for Proto-col

• In user’s Protocol.h– Protocol parameters– Protocol state– Statistics variables– Routing table

AODV data structure in routing_aodv.h

33

Initialization Function Call

34

Network Layer Initialization

35

IP callback functions

• Network Layer routing protocol interacts with IP to route packets and to handle protocol events.

• Routing protocol registers the functions with IP as part of initialization.

Home/libraries/developer/src/network_ip.cpp

36

Event Dispatcher

37

APIs for MAC Layer Communication

• APIs to communicate with MAC Layer for Network Layer Routing Protocols to handle an event(transmitting packets to a node’s peers using MAC Layer

services)

38

Registering Protocol Event Type

• All event types must be registered in – HOME/include/api.h

39

Event Dispatcher of AODV

40

41

Modifying IP Function

• NetworkRoutingGetAdminDistance()– definition of the priority of routing protocol

• HOME/libraries/developer/src/network_ip.cpp

42

Processing Routing Packets

• Define IP Protocol Number for user’s pro-tocol– HOME/libraries/developer/src/network_ip.h

43

• DeliverPacket()– IP Protocol Number from IP header

based switching– checking packet’s

• routing protocol type• interface

– call routing protocol’s packet handler function

44

AODV Protocol Packet Handler

45

Queuing Protocols2011.05.23.

46

Data Structures

• HOME/include/if_queue.h

• QueueOperation– lists of the different types of dequeue

operations

47

• PacketArrayEntry– an entry in the array of stored messages

48

• Queue– the base class that is used to derive

specific queue classes– queue variables– interface functions for queue operations

– refer to Programmer’s Guide 4.4.7.1(p.207)Figure 4-99, Figure 4-100, Figure 4-101

49

Interface Functions• HOME/libraries/developers/src/if_queue.cpp

50

• QUEUE_Setup() create & initialize an object of– the base Queue class– a class derived from the base Queue class

– HOME/include/if_queue.h /libraries/developers/src/if_queue.cpp

51

QUEUE_Setup Example• Messenger Application Queue

– HOME/libraries/developers/src/app_messenger.h

/app_messenger.cpp

52

Queue Operations Example

53

Adding a New Queue Model• a new queuing model derived from the base Queue Class• additionally

– queue-specific parameters– implementing interface functions

54

• queue_myqueue.h– constant definitions– data structure definitions– class definition for new model derived from Queue Class– prototypes for additional interface functions

• queue_myqueue.cpp– include “if_queue.h”, “api.h”– functions to read parameters from configuration file– interface functions for myqueue model

55

Example of RED Queue Model

• Data Structure

• Queue Configuration Parameters

56

• Reading Parameters from configuration file– NetworkIpInitOutputQueueConfiguration

ReadRedConfigurationParameters

57

• ReadRedConfigurationParameters

58

• Deriving new Queue Class from base Queue Class– inherited variables & interface functions from Queue

Class– additionally, model specific

• variables• override interface functions

59

• Modifying QUEUE_Setup Function

60

Scheduler

61

Data Structure

• HOME/include/if_scheduler.h• QueueData

– information for one Queue

62

• Scheduler– the base class that is used to derive specific scheduler

classes– scheduler variables– interface functions for scheduler operations

– refer to Programmer’s Guide 4.4.8.1(p.225)Figure 4-110, Figure 4-111, Figure 4-112

63

Interface Functions• HOME/libraries/developers/src/if_scheduler.cpp

64

• SCHEDULER_Setup() create & initialize an object of– the base Scheduler class– a class derived from the base Scheduler class

– HOME/include/if_scheduler.h /libraries/developers/src/if_scheduler.cpp

65

SCHEDULER_Setup Example• IP function

– HOME/libraries/developers/src/network_ip.h

/network_ip.cpp

66

Scheduler Operations Example

67

Adding a New Scheduler Model• a new scheduler model derived from the base Scheduler

Class

68

Example of StrictPriorityStat Model

• Data Structure

69

• Deriving new Scheduler Class from base Scheduler Class– inherited variables & interface functions from Scheduler

Class– additionally, model specific

• variables• override interface functions

70

• Modifying SCHEDULER_Setup Function

top related