| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Simulation ALOHA in C++
Well I need to simualte the Slotted and Pure ALOHA protocol using C++
so I need to know the parameters and metrics so any one has knowledge or knows any site for that?? Thank u very much |
|
#2
|
|||
|
|||
|
Slotted ALOHA Simulation Parameters
// // global simulation parameters // sim logfile truncate checkpoint-variant slots // frame, slots or milleseconds end // // model 1 definition // model 1 slot 1 // packet slot size in Mb packet-slots 1 channel 1000 // channel speed in Mb/sec protocol SALOHA time 1000000 checkpoint-interval 1 log yes trace no end model 2 slot 1 // packet slot size in Mb packet-slots 1 channel 1050 // channel speed in Mb/sec protocol SALOHA time 1000000 checkpoint-interval 1 log yes trace no end model 3 slot 1 // packet slot size in Mb packet-slots 1 channel 1100 // channel speed in Mb/sec protocol SALOHA time 1000000 checkpoint-interval 1 log yes trace no end model 4 slot 1 // packet slot size in Mb packet-slots 1 channel 1150 // channel speed in Mb/sec protocol SALOHA time 1000000 checkpoint-interval 1 log yes trace no end model 5 slot 1 // packet slot size in Mb packet-slots 1 channel 1200 // channel speed in Mb/sec protocol SALOHA time 1000000 checkpoint-interval 1 log yes trace no end model 6 slot 1 // packet slot size in Mb packet-slots 1 channel 1250 // channel speed in Mb/sec protocol SALOHA time 1000000 checkpoint-interval 1 log yes trace no end model 7 slot 1 // packet slot size in Mb packet-slots 1 channel 1300 // channel speed in Mb/sec protocol SALOHA time 1000000 checkpoint-interval 1 log yes trace no end model 8 slot 1 // packet slot size in Mb packet-slots 1 channel 1350 // channel speed in Mb/sec protocol SALOHA time 1000000 checkpoint-interval 1 log yes trace no end model 9 slot 1 // packet slot size in Mb packet-slots 1 channel 1400 // channel speed in Mb/sec protocol SALOHA time 1000000 checkpoint-interval 1 log yes trace no end model 10 slot 1 // packet slot size in Mb packet-slots 1 channel 1450 // channel speed in Mb/sec protocol SALOHA time 1000000 checkpoint-interval 1 log yes trace no end model 11 slot 1 // packet slot size in Mb packet-slots 1 channel 1500 // channel speed in Mb/sec protocol SALOHA time 1000000 checkpoint-interval 1 log yes trace no end model 12 slot 1 // packet slot size in Mb packet-slots 1 channel 1550 // channel speed in Mb/sec protocol SALOHA time 1000000 checkpoint-interval 1 log yes trace no end model 13 slot 1 // packet slot size in Mb packet-slots 1 channel 1600 // channel speed in Mb/sec protocol SALOHA time 1000000 checkpoint-interval 1 log yes trace no end model 14 slot 1 // packet slot size in Mb packet-slots 1 channel 1650 // channel speed in Mb/sec protocol SALOHA time 1000000 checkpoint-interval 1 log yes trace no end model 15 slot 1 // packet slot size in Mb packet-slots 1 channel 1700 // channel speed in Mb/sec protocol SALOHA time 1000000 checkpoint-interval 1 log yes trace no end model 16 slot 1 // packet slot size in Mb packet-slots 1 channel 1750 // channel speed in Mb/sec protocol SALOHA time 1000000 checkpoint-interval 1 log yes trace no end model 17 slot 1 // packet slot size in Mb packet-slots 1 channel 1800 // channel speed in Mb/sec protocol SALOHA time 1000000 checkpoint-interval 1 log yes trace no end model 18 slot 1 // packet slot size in Mb packet-slots 1 channel 1850 // channel speed in Mb/sec protocol SALOHA time 1000000 checkpoint-interval 1 log yes trace no end model 19 slot 1 // packet slot size in Mb packet-slots 1 channel 1900 // channel speed in Mb/sec protocol SALOHA time 1000000 checkpoint-interval 1 log yes trace no end model 20 slot 1 // packet slot size in Mb packet-slots 1 channel 1950 // channel speed in Mb/sec protocol SALOHA time 1000000 checkpoint-interval 1 log yes trace no end ALOHA PROTOCOL IN C #include <stdio.h> #include <math.h> #include <time.h> #include <dos.h> #define FRAME_TIME 250 main() { float S1, S2, G, J, val[100] ; int I, n, K, delay ; void wait() ; clrscr() ; printf("Please Give the Total Load : "); scanf("%d", &n); printf("Please Enter the value of load \n"); for (I=0; I<n; I++) { scanf("%f", &val[I]); } clrscr(); printf("\nOUTPUT 1: (THROUGHPUT Vs LOADCURVE)\n\n"); printf("s=g*exp(-G) FOR SLOTTED ALOHA * \n"); printf("s=g*exp(-2G) FOR PURE ALPHA #\n"); printf("\n------ (THROUGHPUT PER FRAME TIME)----\n"); for(K=0; K<n; K++) { G=val[K]; S1 = G * exp (-G); S2 = G * exp(-2 * G); printf("%1.3f", G ); for (I=0; I <=S1*20; I++) { printf(" "); } printf("*"); for(I=S2*20; I<=S2*75; I++ ) { printf(" "); } printf("#\n"); } printf("G (ATTEMPTS PER PACKET TIME) \n\n"); wait() ; getch() ; clrscr() ; printf("\nOUTPUT 2 (DELAY Vs THROUGHPUT) \n\n"); printf("\n-----(THOUGHPUT PER FRAME TIME)----\n"); for(K=0; K<n; K++) { G=val[K]; S1 = G * exp (-G); printf("3"); for (I=0; I <=S1*2.7; I++) { printf(" "); } printf("*\n"); } printf("\n"); printf("---- DELAY -----"); wait(); getch(); clrscr(); } void wait() { sound(440); delay(300); nosound(); } OUTPUT of (THROUGHPUT V/S LOADCURVE) s=g*exp(-G) FOR SLOTTED ALOHA * s-g*exp(-2G) FOR PURE ALPHA # -----------(THROUGHPUT PER FRAME TIME) -----> 0.0000003 * # 0.5000003 * # 1.0000003 * # 1.5000003 * # 2.0000003 * # 2.5000003 * # 3.0000003 * # 3.5000003 * # G (ATTEMPTS PER PACKET TIME) OUTPUT of (DELAY V/S THROUGHPUT) ------(THROUGHPUT PER FRAME TIME) ----> 3 * 3* 3* 3* 3* 3* 3* 3* 3* --- DELAY------ Last edited by DudeThatWasRude : July 6th, 2003 at 12:38 AM. |
|
#3
|
|||
|
|||
|
project
hi
did u get the idea regarding ur project Quote:
|
![]() |
| Viewing: Dev Articles Community Forums > Programming > C/C++ Help > Simulation ALOHA in C++ |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|