GloMoSim - Staff — Department of Computer Architecture...

25
GloMoSim Global Mobile Information System Simulator Supervisor: Dr.Mehdi Dehghan Amir Darehshoorzadeh

Transcript of GloMoSim - Staff — Department of Computer Architecture...

Page 1: GloMoSim - Staff — Department of Computer Architecture ...people.ac.upc.edu/amir/index_files/Glomosim.pdf · Overview • GloMoSim is the Global Mobile Information Systems Simulation

GloMoSim

Global Mobile Information SystemSimulator

Supervisor: Dr.Mehdi Dehghan

Amir Darehshoorzadeh

Page 2: GloMoSim - Staff — Department of Computer Architecture ...people.ac.upc.edu/amir/index_files/Glomosim.pdf · Overview • GloMoSim is the Global Mobile Information Systems Simulation

Outline• Overview • Scalability in Glomosim• Installation on windows• Running basic simulation• Traffic generator• Configuring mobility• Structure of Glomosim• Timers• How to add a new timer to the Glomosim• How to add a new packet to the Glomosim• How to add a new parameter to the scenario file• How to collect results from output file• Other file of interest

Page 3: GloMoSim - Staff — Department of Computer Architecture ...people.ac.upc.edu/amir/index_files/Glomosim.pdf · Overview • GloMoSim is the Global Mobile Information Systems Simulation

Overview

• GloMoSim is the Global Mobile Information Systems Simulation Library from UCLA.

• Specially oriented to simulate wireless, ad-hoc networks.

• Built as a set of libraries. The libraries are built in Parsec( a C-based discrete event simulation language).

• It can be obtained from : http://pcl.cs.ucla.edu/projects/glomosim/

Page 4: GloMoSim - Staff — Department of Computer Architecture ...people.ac.upc.edu/amir/index_files/Glomosim.pdf · Overview • GloMoSim is the Global Mobile Information Systems Simulation

GloMoSim is scalable

• Node Aggregation

(0, 0), (49, 0), (0, 49), and (49, 49).

Page 5: GloMoSim - Staff — Department of Computer Architecture ...people.ac.upc.edu/amir/index_files/Glomosim.pdf · Overview • GloMoSim is the Global Mobile Information Systems Simulation

Installation on a Windows

• Beforehand:– Visual Studio 6.0– Java SDK 1.2+

• Un-gzip the distribution package.• Install the glomosim and parsec

directories into %programfiles%\.• Copy the windows NT files from the

source parsec to the C:\Parsec• Set your path environments

Page 6: GloMoSim - Staff — Department of Computer Architecture ...people.ac.upc.edu/amir/index_files/Glomosim.pdf · Overview • GloMoSim is the Global Mobile Information Systems Simulation

Installation on a Windows …

• Set your path environments.– PCC_DIRECTORY

C:\Parsec

– PATHC:\Parsec\bin

– Visual Studio vcvars.bat

• Check if pcc works from anywhere.( Check your pcc environment by pcc –env )

Page 7: GloMoSim - Staff — Department of Computer Architecture ...people.ac.upc.edu/amir/index_files/Glomosim.pdf · Overview • GloMoSim is the Global Mobile Information Systems Simulation

Installation on a Windows …

• Go to ./glomosim/main and do makent.bat.

• Once the make is complete, GloMoSim is ready to use, and lives in bin.– run .\glomosim\bin\glomosim

config.in– Compare glomo.stat &

glomo.stat.sample

• Don’t forget to compile the Java GUI, in java_gui.( javac *.java )

Page 8: GloMoSim - Staff — Department of Computer Architecture ...people.ac.upc.edu/amir/index_files/Glomosim.pdf · Overview • GloMoSim is the Global Mobile Information Systems Simulation

Running a Basic Simulation

• GloMoSim depends on its config.in file.

• Let’s go through some of the basic variables in config.in.

• SIMULATION -TIME– Total time elapsed inside of

simulation.100NS,100MS,100S or 100 , …

• SEED• TERRAIN-DIMENSIONS

– The area you are simulating in.

• NUMBER-OF-NODES– The number of nodes.

Page 9: GloMoSim - Staff — Department of Computer Architecture ...people.ac.upc.edu/amir/index_files/Glomosim.pdf · Overview • GloMoSim is the Global Mobile Information Systems Simulation

Basic Variables …

• NODE-PLACEMENT– random, grid, uniform, or by

input file allowed.– NODE-PALCEMENT-FILE

./NODES.INPUTnodeAddr 0 (x, y, z)

• MOBILITY– Can be none, random-waypoint,

by trace• MAC-PROTOCOL

– Defines what MAC you use. 802.11, MACA, CSMA, TSMA supported.

• ROUTING-PROTOCOL– Bellman-Ford, AODV, DSR,

LAR, WRP, Fisheye, ZRP and static supported.

• APP-CONFIG-FILE

./app.conf• RADIO-TX-POWER value

Page 10: GloMoSim - Staff — Department of Computer Architecture ...people.ac.upc.edu/amir/index_files/Glomosim.pdf · Overview • GloMoSim is the Global Mobile Information Systems Simulation

Basic Variables …

• Parameters for reporting statistics (YES/NO):– APPLICATION-

STATISTICS– TCP-STATISTICS– UDP-STATISTICS– ROUTING-

STATISTICS– NETWORK-LAYER-

STATISTICS

– MAC-LAYER-STATISTICS

– RADIO-LAYER-STATISTICS

– CHANNEL-LAYER-STATISTICS

– MOBILITY-STATISTICS

– GUI-OPTION– GUI-RADIO– GUI-ROUTING

Page 11: GloMoSim - Staff — Department of Computer Architecture ...people.ac.upc.edu/amir/index_files/Glomosim.pdf · Overview • GloMoSim is the Global Mobile Information Systems Simulation

Radio Range• ./glomosim/bin/ radio_range config.in

Change RADIO-TX-POWER to 7.874

• ./glomosim/bin/ radio_range config.in

Page 12: GloMoSim - Staff — Department of Computer Architecture ...people.ac.upc.edu/amir/index_files/Glomosim.pdf · Overview • GloMoSim is the Global Mobile Information Systems Simulation

Configuring application file (app.conf)

• FTP <src> <dest> <items to send> <start time>• FTP 0 1 10 0S•FTP 0 1 0 10NS

• FTP/GENERIC <src> <dest> <items to send> <start time> <end time>

•FTP/GENERIC 0 1 10 1460 0S 600S•FTP/GENERIC 0 1 0 1460 0S 0S

• TELNET <src> <dest> <session duration> <start time>•TELNET 0 1 100S 0S•TELNET 0 1 0S 0S

Page 13: GloMoSim - Staff — Department of Computer Architecture ...people.ac.upc.edu/amir/index_files/Glomosim.pdf · Overview • GloMoSim is the Global Mobile Information Systems Simulation

Configuring application file …

•CBR <src> <dest> <item to send> <item size> <interval> <start time> <end time>

•CBR 0 1 10 1460 1S 0S 600S•CBR 0 1 0 1460 1S 0S 300S•CBR 0 1 0 1460 1S 0S 0S

• HTTP <Address> <num_of_server> <server_1> …<server_n> <start> <thresh>

•HTTP 1 3 2 5 11 10S 120S

Page 14: GloMoSim - Staff — Department of Computer Architecture ...people.ac.upc.edu/amir/index_files/Glomosim.pdf · Overview • GloMoSim is the Global Mobile Information Systems Simulation

Configuring Mobility

•NONE•RANDOM-WAYPOINT•Trace

MOBILITY mobility_model

MOBILITY RANDOM-WAYPOINTMOBILITY-WP-PAUSE Value

MOBILITY-WP-MIN-SPEED Minimum SpeedMOBILITY-WP-MAX-SPEED Maximum Speed

MOBILITY-TRACE-FILE ./mobility.in

node-address simclock (x y z)10 100S (200.0, 150.0, 0.0)

Page 15: GloMoSim - Staff — Department of Computer Architecture ...people.ac.upc.edu/amir/index_files/Glomosim.pdf · Overview • GloMoSim is the Global Mobile Information Systems Simulation

Structure of Glomosim

/application Contains code for the application layer/bin For executable and input/output files/include Contains common include files/java-gui Contains the visual tool/mac Contains the code for mac layer/main Contains the basic framework design/network Contains the code for the network layerScenarios Contains some example scenariosTransport Contains code for the transport layer

Timers:

./glomosim/include/structmsg.h

Page 16: GloMoSim - Staff — Department of Computer Architecture ...people.ac.upc.edu/amir/index_files/Glomosim.pdf · Overview • GloMoSim is the Global Mobile Information Systems Simulation

Use Timersvoid RoutingAodvInitiateRREQ(GlomoNode *node, NODE_ADDR

destAddr){

…….RoutingAodvSetTimer (node, MSG_NETWORK_CheckReplied,

(clocktype)2 * ttl * NODE_TRAVERSAL_TIME);

} /* RoutingAodvInitiateRREQ */

void RoutingAodvSetTimer ( GlomoNode *node, long eventType, clocktype delay)

{Message *newMsg;NODE_ADDR *info;……GLOMO_MsgSend (node, newMsg, delay);

} /* RoutingAodvSetTimer */

Page 17: GloMoSim - Staff — Department of Computer Architecture ...people.ac.upc.edu/amir/index_files/Glomosim.pdf · Overview • GloMoSim is the Global Mobile Information Systems Simulation

Use Timers …

void RoutingAodvHandleProtocolEvent (GlomoNode *node, Message *msg){

…………case MSG_NETWORK_CheckReplied:{

/* Route has not been obtained */if (!RoutingAodvCheckRouteExist (*destAddr, &aodv->routeTable)){

RoutingAodvRetryRREQ (node, *destAddr);……..

} /* if under the retry limit */………

}……..

}

Page 18: GloMoSim - Staff — Department of Computer Architecture ...people.ac.upc.edu/amir/index_files/Glomosim.pdf · Overview • GloMoSim is the Global Mobile Information Systems Simulation

How Add a new timer to Glomosim

In .\glomosim\include\structmsg.h add your timer name :

MSG_NETWORK_SendHello

In your protocol set timer for this message :RoutingOdmrpSetTimer (node, MSG_NETWORK_SendHello,

ANY_DEST, delay);

In RoutingOdmrpHandleProtocolEvent Function do process for this event

void RoutingOdmrpHandleProtocolEvent (GlomoNode *node, Message *msg){

……case MSG_NETWORK_SendHello:{

RoutingOdmrpSendHello(node);…..

}

Page 19: GloMoSim - Staff — Department of Computer Architecture ...people.ac.upc.edu/amir/index_files/Glomosim.pdf · Overview • GloMoSim is the Global Mobile Information Systems Simulation

How Add a new Packet to GlomosimAdd a new Packet name to the packetType of protocol

typedef enum{

ODMRP_JOIN_REPLY,…..ODMRP_HELLO

} ODMRP_PacketType;

Add a new Packet structure to the header file of your protocoltypedef struct{

ODMRP_PacketType pktType;…….ODMRP_ReservedType

} ODMRP_Hello;

Page 20: GloMoSim - Staff — Department of Computer Architecture ...people.ac.upc.edu/amir/index_files/Glomosim.pdf · Overview • GloMoSim is the Global Mobile Information Systems Simulation

How Add a new Packet to Glomosim …

void RoutingOdmrpHandleProtocolPacket (GlomoNode *node, Message *msg, NODE_ADDR srcAddr, NODE_ADDR destAddr)

{…………..

switch (*odmrpHeader){

……case ODMRP_HELLO:

RoutingOdmrpHandleHello(node,msg);break;………

}……..

}

Page 21: GloMoSim - Staff — Department of Computer Architecture ...people.ac.upc.edu/amir/index_files/Glomosim.pdf · Overview • GloMoSim is the Global Mobile Information Systems Simulation

How to add a new parameter to the scenario file (config.in)

Add your new parameter to the scenario file

QOS-FILE ./qos.in

In driver.pc add:

retVal = GLOMO_ReadInt (-1, …., " QOS-FILE ", buffer);

Page 22: GloMoSim - Staff — Department of Computer Architecture ...people.ac.upc.edu/amir/index_files/Glomosim.pdf · Overview • GloMoSim is the Global Mobile Information Systems Simulation

How to Collect resultsAdd #define EXCEL in your protocol

void RoutingOdmrpInit (GlomoNode *node,GlomoRoutingOdmrp**odmrpPtr,const GlomoNodeInput *nodeInput)

{…………..

#ifdef EXCELremove(ODMRP_FILE);excel = fopen(ODMRP_FILE, "a"); if (excel == NULL) {

fprintf(stderr, "ODMRP: cannot open excel stat file.\n");assert(FALSE);

}fprintf(excel, ‘write the columns name’);fflush(excel);fclose(excel);

#endif}

Page 23: GloMoSim - Staff — Department of Computer Architecture ...people.ac.upc.edu/amir/index_files/Glomosim.pdf · Overview • GloMoSim is the Global Mobile Information Systems Simulation

How to Collect results …void RoutingOdmrpFinalize (GlomoNode *node){

………….FILE *excel; #ifdef EXCEL

excel = fopen(ODMRP_FILE, "a");if (excel == NULL) {

fprintf(stderr, "ODMRP: cannot open excel stat file.\n");assert(FALSE);

}fprintf(excel,"%d\t%d\t%d\t\n",status parameters);fflush(excel);fclose(excel);

#endif………..

}

Page 24: GloMoSim - Staff — Department of Computer Architecture ...people.ac.upc.edu/amir/index_files/Glomosim.pdf · Overview • GloMoSim is the Global Mobile Information Systems Simulation

Other files of interest:

– glomo.stat is produced by the simulation, and contain all statistics.

– mcast.conf contains multicast group information.Node_Address Group_Address Join_Time Leave_Time

15 3758096386 0S 25S

– Debug.out./glomosim/bin/glomosim config.in>debug.out

Page 25: GloMoSim - Staff — Department of Computer Architecture ...people.ac.upc.edu/amir/index_files/Glomosim.pdf · Overview • GloMoSim is the Global Mobile Information Systems Simulation

Thanks