Professional Documents
Culture Documents
Outline
Introduction
Introduction
3
2 components
Simulation Environment
Simulation Language
scalable simulation environment supports Wire & Wireless network layered approach Standard APIs parallel discrete-event simulation
Parsec
C-based
simulation language sequential and parallel execution discrete-event simulation models can be used as a parallel programming language. developed by the Parallel Computing Laboratory at UCLA
6
Clustering (optional)
Data Link MAC
Radio Model
Propagation Model/Mobility Model
Application: TCPLIB (telnet, ftp) , CBR (Constant Bit Rate traffic), Replicated file system, HTTP Transport: TCP (Free BSD), UDP, NS TCP (Tahoe) and others Unicast Routing: AODV, Bellman-Ford, DSR, Fisheye, Flooding, LAR (Scheme 1), NS DSDV, OSPF, WRP MAC Layer: CSMA, FAMA, MACA, IEEE 802.11 Radio: Radio with and without capture capacity Propagation: Free Space, Rayleigh, Ricean, SIRCIM Mobility: Random Waypoint, Random Drunken, ECRV, Group Mobility
struct glomo_mac_str { MAC_PROTOCOL macProtocol; int interfaceIndex; BOOL macStats; void *macVar; } GlomoMac;
mac\mac.h
10
Packets & Message going through layers are annotated with information that simulate inter-layer parameter passing
11
Scheduling Events
Messages
Cell Messages
12
Non-packet Message
MSG_MAC_TimerExpired
Self scheduled (timer) events
GLOMO_MacLayer()
MAC
Mac802_11StartTimer()
13
Packet/cell Message
NetworkIpSend PacketToMacLayer()
Network
Network
NetworkIpReceive PacketFromMacLayer()
Inter-layer packets
GLOMO_MacNetwork LayerHasPacketToSend()
Add Header
MAC
MAC
Mac802_11TransmitDataFrame()
Inter-layer packets GLOMO_RadioStartTransmittingPacket()
Radio Layer
Radio Layer
Inter-Node Packet
14
Packet/cell Message
NetworkIpSend PacketToMacLayer()
Network
/* Data frames. NetworkIpReceive */ Header + Data Network typedef struct M802_mac_frame PacketFromMacLayer() { M802_11FrameHdr hdr; Inter-layer packets
char payload[ MAX_NW_PKT_SIZE];
Mac802_11ProcessFrame() } M802_11_MacFrame; Remove Header Add Header MAC MAC typedef struct _Mac802_11FrameHdr GLOMO_MacReceive {unsigned short frameType; Mac802_11TransmitDataFrame() PacketFromRadio () char Padding1[2]; int duration; (MAC Inter-layer Header Frame) + packets NODE_ADDR destAddr; Inter-layer packets (Network Layer Packet) NODE_ADDR sourceAddr; GLOMO_RadioStartTransmittingPacket() RadioAccnoiseLayer () } M802_11FrameHdr;
GLOMO_MacNetwork LayerHasPacketToSend()
Radio Layer
Radio Layer
Inter-Node Packet
15
16
17
} M802_11LongControlFrame; \mac\802_11.h 18
Message Parameters
Message Destination:
Node ID Layer in that node Protocol in that layer (optional) Instance (Interface) optional
19
Scheduling an Event
20
Destination Layer 21
Message Scheduling
GLOMO_MsgSend(node, *msg, delay)
GLOMO_RADIO_LAYER: GLOMO_RadioLayer(node, msg) GLOMO_MAC_LAYER: GLOMO_MacLayer(node, msg);
if delay == 0 (msg)->layerType
22
GLOMO_MsgFree(node, msg);
}
23
Transmitting Packet
Allocate Message
hdr.frameType = M802_11_DATA; hdr.sourceAddr = node->nodeAddr; hdr.destAddr = destAddr; GLOMO_MsgPacketAlloc(node, pktToRadio, topPacket>packetSize); memcpy(pktToRadio->packet, topPacket->packet, topPacket->packetSize);
24
GLOMO_MsgAddHeader(node, pktToRadio, sizeof(M802_11FrameHdr) ); memcpy(pktToRadio->packet, &hdr, sizeof(M802_11FrameHdr)); StartTransmittingPacket(node, M802, pktToRadio, M802_11_DIFS);
Transmit Packet
25
Processing Packet
Mac802_11ReceivePacketFromRadio(){
if (hdr->destAddr == node->nodeAddr) { switch (hdr->frameType) { case M802_11_RTS: case M802_11_DATA: } else if (hdr->destAddr == ANY_DEST){ switch (hdr->frameType) { case M802_11_DATA: Mac802_11ProcessFrame(node, M802, msg); }
26
Message Function
27
28
Basic Structure
/doc contains the documentation /scenarios contains directories of various sample configuration topologies
/main contains the basic framework design /bin for executable and input/output files
30
31
CBR 0 1 10 512 1S 0S 0S
32
In the directory
Application Transport
(.h) Basic Definition of functions and data objects (.pc) Actual Functions (Layer.pc) Layer Interface
MAC Radio
802_11 .h cama.h
mac .pc 33
} GlomoMac802_11;
35
Initialization Function
void Mac802_11Init (GlomoNode *node, int interfaceIndex, const GlomoNodeInput *nodeInput) { GlomoMac802_11 *M802 = (GlomoMac802_11*) checked_pc_malloc(sizeof(GlomoMac802_11)); M802->myGlomoMac = node->macData[interfaceIndex]; M802->myGlomoMac->macVar = (void *)M802; // Init Data here M802->pktsSentUnicast = 0;
36
37
Finalization Function
void Mac802_11Finalize (GlomoNode *node, int interfaceIndex) { GlomoMac802_11 *M802 = (GlomoMac802_11*)node->macData[interfaceIndex]->macVar; if (M802->myGlomoMac->macStats == TRUE) { Mac802_11PrintStats(node, M802); } sprintf(buf, "UCAST (non-frag) pkts sent " "to chanl: %ld", M802->pktsSentUnicast); GLOMO_PrintStat(node, "802.11", buf); }
38
config.in
39
40
Stats Printed for Each Node Youll Probably need to add Statistics
41
Adding Stats
Go through Header and add for Statistic Variables
typedef struct glomo_mac_802_11_str { GlomoMac* myGlomoMac; int state; /* Statistics collection variables. */ long pktsSentUnicast; <---------- Add Stat here !!! } GlomoMac802_11; 802_11.h
42
Adding Stats
Initialize your extra stat to zero in the initialize function
void Mac802_11Init(){ M802->myGlomoMac = node->macData[interfaceIndex]; M802->state = M802_11_S_IDLE; /* initial Statistic Variable to zero */ M802->pktsSentUnicast = 0; M802->pktsSentBroadcast = 0; M802->pktsGotUnicast = 0;
43
Adding Stats
Add code to increment your counter
void Mac802_11ProcessFrame(){ hdr = (M802_11FrameHdr *)frame ->packet; if (hdr->destAddr == ANY_DEST) { M802->pktsGotBroadcast++; } else{ M802->pktsGotUnicast++; GLOMO_MsgFree(node, frame); }
44
Adding Stats
Add a print statement in Finalize function
void Mac802_11Finalize(){ M802 = node->macData[interfaceIndex]->macVar; sprintf(buf, "UCAST (non-frag) pkts sent " "to chanl: %ld", M802->pktsSentUnicast); GLOMO_PrintStat(node, "802.11", buf); sprintf(buf, "BCAST pkts sent to chanl: , "%ld", M802->pktsSentBroadcast); GLOMO_PrintStat(node, "802.11", buf);
45
Obtaining Glomosim/Parsec
Web site:
http://pcl.cs.ucla.edu/projects/parsec
http://pcl.cs.ucla.edu/projects/glomosim
Questions:
PARSEC:
glomosim-2.0
\glomosim
\parsec
47
Installing Parsec
copy correct directory to be parsec in
Linux
/usr/local/parsec C:\Parsec
Windows
\glomosim-2.0\parsec\
48
Installing Parsec
49
Installing GloMoSim
"make depend" to create list of depndencies in the Makefile. Make sure that the right path for the Parsec compiler is specified in the Makefile for the "PAR" variable. Run "make" to create the executable
50
51
Runnig Program
52
PCC_PP_OPTIONS
53
End
54