PARSEC/Glomosim Tutorial - PowerPoint PPT Presentation

1 / 20
About This Presentation
Title:

PARSEC/Glomosim Tutorial

Description:

PARSEC keeps track of the simulation time by using an internal discrete simulation clock ... How would we simulate a wireless sensor network under PARSEC ? ... – PowerPoint PPT presentation

Number of Views:462
Avg rating:3.0/5.0
Slides: 21
Provided by: vlas4
Category:

less

Transcript and Presenter's Notes

Title: PARSEC/Glomosim Tutorial


1
PARSEC/Glomosim Tutorial
  • Vlasios Tsiatsis
  • EE206
  • UCLA, 5/1/02

2
PARSEC Entities
  • Discrete-event simulation language
  • Basically C with extensions
  • parallel executing ENTITIES
  • entity Sort (int n, int a20)
  • sorting()
  • finalize
  • //entity declaration, creation
  • ename s1
  • ...
  • sl new Sort(20, a20)
  • ...

useful for statistics collection
entity body
entity handle
3
PARSEC Messages
  • Entities communicate via message passing
  • Each entity has one built-in message queue
  • time-stamped, typed, MESSAGES like C structs
  • message Request
  • int units
  • ename id
  • / declaration - initialization/
  • message Request myrequest
  • myrequest.units 20
  • myrequest.id self

handle of current entity
4
Entity Communication
  • Entities exchange messages using the send and
    receive primitives
  • send send a typed message to an entity
  • message Request myrequest
  • send Request10, self to E2
  • send oldrequest to E2
  • send oldrequest to E2 after 5

This modifier changes the message timestamp
5
Entity Communication (contd)
  • receive process message from the internal queue
    (blocking call)

/ complex receive / receive (Request r) req
r or receive (Release r) units
r.units or timeout in (5) ...
message Request req int units / simple receive
/ receive (Request r) req r
  • Two semantics
  • in timeout has highest priority
  • after receive has highest priority

6
Timing considerations
  • PARSEC keeps track of the simulation time by
    using an internal discrete simulation clock
  • Only a few statements can advance this clock
  • send M1 to E1 after T with Tgt0
  • timeout with non-zero timeovalue
  • hold(T) with Tgt0 (like a delay function)
  • so if you dont have any of these statements in
    your code the simulation time is going to be
    zero!
  • send statements deposit the message
    asynchronously in the receiving entity queue
    time-stamping it with the current or modified time

7
Timing considerations (contd)
  • receive statements take the earliest message from
    queue (according to timestamps) and if there are
    multiple messages with the same timestamp the
    order is NOT deterministic!
  • The user can get the value of simulation clock by
    the simclock() function
  • The user can set the maximum value of simulation
    clock by the setmaxclock() function

8
Development Cycle
  • Your equivalent main() function is the entity
    driver()
  • Use this entity to create all the other entities
    and setup the simulation environment
  • Also use this entity to collect all the
    statistics from all other entities by sending
    them request messages
  • If you need to connect entities together use
    messages with the entity reference (self) in the
    message
  • If an entity A needs some information from
    another entity B create a dummy request message
  • send DummyReq to B // no delay
  • receive(DummyRep rep)
  • needed_info rep.info

9
Example
  • How would we simulate a wireless sensor network
    under PARSEC ?
  • First thought- one entity per physical node
  • What about node communication ? How do you model
    the wireless channel?
  • The solution follows a layered approach
  • 1 entity type for the channel
  • 1 entity type for the physical layer
  • 1 entity type for link layer
  • and so on

10
Example NESL Code Organization
  • To keep things simple we only have 3 types of
    networking entity types
  • Channel
  • Radio (physical and MAC layer)
  • Node (network and application layer)
  • And one entity responsible for setting up the
    simulation environment (driver entity) and
    gathering the simulation results

The author of the first version of this code is
Curt Schurgers
11
Architecture
MAIN
Node 1
Node N
Radio 1
Radio N
Channel
One physical sensor node
Statistics messages
Network messages
  • Each building block corresponds to 4 files
  • ltentity_namegt.pc Implementation
  • ltentity_namegt.h Declarations
  • ltentity_namegt_functions.h Functions
  • ltentity_namegt_parameters.h Parameters

12
PARSEC Implementation
main.pc code
entity driver(int argc,char argv) ... //
Topology (xcoord, ycoord) creation ... channel
(ename)malloc(sizeof(ename)) channel new
Channel(self,num_nodes,BER) ... for
(i0iltnum_nodesi) nodeinew
SensorNode(i,xcoordi,ycoordi,TX_RANGE,
self, channel, num_nodes) ... while(TRUE) re
ceive (StatisticsMessage) ... ...
MAIN
SensorNodes
13
Main entity
  • Read the command line arguments
  • Create the topology
  • Create the Channel
  • Create the individual Nodes and pass a reference
    to the Channel
  • Wait for statistics collection messages from
    nodes (when nodes finish they send all the
    desired statistics to the main entity)

14
PARSEC Implementation
node.pc code
entity SensorNode(int node_ID,float xcoord,float
ycoord, float Txrange, ename top,ename
channel, int num_nodes) ... // inform the
channel about the node location ... radio new
Radio(node_ID,self,channel,top,num_nodes,1) //
connect the channel with the radio by sending a
// message to the channel
channelmsg.radio radio send channelmsg to
channel ... while(1) receive(NMsg_1) ... or
receive (NMsg_2) ... ... or receive (NMsg_N)
...
MAIN
Node 1
Radio
15
PARSEC Implementation
radio.pc code
entity Radio(int id, ename node, ename channel,
ename top, int num_nodes, int radio_mode)
... while(1) receive(RMsg_1) ... or
receive (RMsg_2) ... ... or receive (RMsg_N)
...
Node
MAIN
Radio 1
Channel
channel.pc code
entity Channel(ename top,int num_nodes,float ber)
... while(1) receive(CMsg_1) //topology
maintenance here or receive (CMsg_2) ...
... or receive (CMsg_N) ...
Radio
Channel
16
Radio/Channel Entity
  • The Radio entity has 3 modes
  • Ideal Radio No collisions
  • Collisions, no channel sensing, no TX buffer
  • Collision Detection, radio buffers
  • Radio entity sends a message to the node entity
    every time a packet transmission ends because the
    TX time is not deterministic due to buffering and
    backoff delays (mode 3)
  • Channel entity maintains a neighborhood matrix
    updated whenever a new node entity is created
  • Channel entity routes packets from one node to it
    radio neighbors

17
GlomoSim Model
  • GlomoSim uses PARSEC
  • All nodes are aggregated into PARSEC aggregation
    entities for
  • Scalability
  • ease of neighborhood calculations (remember this
    model was created for mobile ad-hoc networks)
  • Current release supports only 1 partition
  • Node state is maintained in a global data
    structure BUT simulation code for one node does
    not access other nodes state

GLOMOPartition
18
GlomoSim Model (contd)
  • Follows a layered approach for a network protocol
    architecture
  • Uses one entity for all the communication layers
    for ease of inter-layer communication
  • Neighboring layers exchange messages by fixed
    APIs

FTP, TELNET, HTTP, CBR
TCP, UDP
AODV, DSR, LAR, ODMRP, ZRP
MACA, CSMA, 802.11, TSMA
Free space, Two ray, Rayleigh, Ricean
19
Protocol Layer Functions
Each layer has 3 major functions
  • Initialization Function
  • void NetworkLar1Init(GlomoNode node,
  • GlomoNetworkLar1 lar1,
  • const GlomoNodeInput nodeInput)
  • Finalization Function statistics
  • void NetworkLar1Finalize(GlomoNode node)
  • Message Dispatcher Function
  • void NetworkLar1HandleProtocolPacket(
  • GlomoNode node, Message msg)
  • Data structures
  • GlomoNode State of a node (handle of a node)
  • Message Message or packet
  • GlomoNetworkLar1 Protocol Specific information
    (e.g. statistics variables)
  • GlomoNodeInput configuration options from
    command line

20
If everything else fails
  • Read the manuals (they are relatively small!)
  • PARSEC http//pcl.cs.ucla.edu/projects/parsec/
  • GlomoSim http//pcl.cs.ucla.edu/projects/glomosim/
  • Read the source code
  • You may need to modify it
  • You may need to watch the flow of packets from
    one layer to another
Write a Comment
User Comments (0)
About PowerShow.com