This action might not be possible to undo. Are you sure you want to continue?

COMP6340: Network Quality Assurance and Simulation

**Ns2-PROJECT Phase II – Simulation of ALOHA
**

http://www.auburn.edu/~jinjinr/comp6340/

Authors Ben Brahim Taha Jingren Jin Arunkumar T J

1

Department of CSSE, Auburn University

Contents

1 2 INTRODUCTION.............................................................................................................................3 THEORETICAL ANALYSIS ..........................................................................................................4 2.1 2.1.1 2.1.2 2.1.3 2.2 2.2.1 3 THE ALOHA PROTOCOL ...............................................................................................................4 The Basic Concept..............................................................................................................4 Theoretical Analysis of Pure Aloha ...................................................................................4 Theoretical Analysis of Slotted ALOHA ............................................................................5 CARRIER SENSE MULTIPLE ACCESS WITH COLLISION DETECTION .............................................6 Theoretical Analysis of CSMA/CD ....................................................................................6

SIMULATION AND ANALYSIS ....................................................................................................8 3.1 3.2 3.2.1 3.2.2 3.2.3 3.2.4 3.2.5 3.2.6 3.3 3.3.1 3.3.2 3.3.3 PROBLEM STATEMENT .................................................................................................................8 SIMULATION AND ANALYSIS OF PURE ALOHA .............................................................................8 Verification of maximum Link Efficiency of ALOHA.........................................................8 Experiments with the simulator .........................................................................................9 Variation of Parameters during simulation .....................................................................10 Effect of Bandwidth on Link Efficiency............................................................................11 Effect of Frame size on Link Efficiency ...........................................................................12 Effect of Number of stations on Link Efficiency ..............................................................12 SIMULATION AND ANALYSIS OF SLOTTED ALOHA.....................................................................13 Verification of maximum Link Efficiency of ALOHA.......................................................13 Experiments with the simulator .......................................................................................14 Variation of Parameters during simulation .....................................................................15

Statistical observations ..................................................................................................................................16 Correlation of collision fraction with the idle time fraction .........................................................................16

3.3.4 3.3.5 3.3.6 3.3.7

3.3.7.1

Effect of Bandwidth on Link Efficiency............................................................................17 Effect of Frame size on Link Efficiency ...........................................................................18 Effect of Number of stations on Link Efficiency ..............................................................19 Experiment with different back off distributions .............................................................19

Uniform back off distribution.....................................................................................................19

3.4 3.4.1 3.4.2 3.4.3 4

SIMULATION AND ANALYSIS OF CSMA/CD..............................................................................21 Verification of maximum Link Efficiency of ALOHA.......................................................22 Effect of Bandwidth on efficiency of CSMA/CD..............................................................24 Effect of Number of stations on efficiency of CSMA/CD.................................................25

CONCLUSION................................................................................................................................27 4.1 4.1.1 4.1.2 4.1.3

4.1.3.1

**THE SIMULATION TOOL .............................................................................................................28 Characterization of the model .........................................................................................28 The simulation language..................................................................................................29 The simulator design ........................................................................................................29
**

Classes.........................................................................................................................................29

4.1.4

Source Code......................................................................................................................32

2

Department of CSSE, Auburn University

Abstract

The primary goal of any MAC protocol is to maximize utilization of the shared physical medium. In this project, we use simulation as an analysis tool to study the efficiencies of three different random access protocols namely, ALOHA, Slotted ALOHA and CSMA/CD with different network parameters. It has been proven theoretically that the performance of the two variants of Aloha, Pure Aloha and Slotted Aloha can not exceed 18.4% and 36.8% respectively. CSMA/CD can be close to 100% efficient under certain conditions. The observations from our simulation validate the theoretical results to a large extent.

1 Introduction

The medium access control (MAC) is a sub layer of the OSI link layer. It has to organize and handle how different stations may access a shared medium (the wire). It is well known that the problems related to resource-sharing mostly involve strong formal models. Indeed, the issues related to resource-sharing are fairness, good-put improvement, scalability and algorithms complexity. In this report, we are presenting, simulating and analyzing a set of well known MAC protocols. The protocols we are studying are Pure Aloha and Slotted Aloha and CSMA/CD. Aloha is one of the first protocols to have been proposed as a solution to Multiple Access Control. The word Aloha stands for Hello in native Hawaiian language. The Aloha family protocols were proposed by a research team led by Abramson at Hawaii University. We will give a detailed description of Aloha algorithms in the next section. It has been proven that the highest attainable link efficiency is 18.4% for Pure Aloha and 36.8% for Slotted Aloha. CSMA/CD is a protocol that works contrary to ALOHA. A practical version of CSMA/CD is the 802.3 protocol that has been used as MAC for Ethernet. Theoretically efficiency of CSMA/CD can be close to 100%. Through this work we have designed a simulation tool that validates the theoretical results. We also discuss some extreme cases where the efficiency of Aloha goes beyond the theoretical maximum and some other cases where it is extremely low. This report is organized in the following fashion. Chapter 2 is a description of the different MAC algorithms. It also presents the theoretical analysis of each protocol’s efficiency including the statistical approaches used. In the 3rd Chapter we depict our simulation model for Aloha and explain the statistical approaches that we have adopted in the realization of our simulation tool. In the fourth and last part of this work we present the results of our simulations. We give an analysis and our interpretation of the results and conclude.

3

Let T be the frame transmission time. When a node has a packet to transmit. Consider a new or retransmitted frame scheduled for transmission at some instant t. it retransmits after some random wait time.2 Theoretical Analysis of Pure Aloha Assume all packets have the same fixed size Sp (Bytes). 2. The results of the analysis form the basis of our simulation and acts as a verification model. The nodes population generates a traffic that is Poisson process with mean N frames per T. A simple strategy like this may lead to scenarios where multiple nodes try to send at the same time. Auburn University 2 Theoretical Analysis This section discusses in detail the theoretical analysis for the performance of different MAC protocol that we analyze as part of the project. 2.If we define the throughput as the fraction of time during which the useful information is carried on the channel. As a result. 2. theoretical results provide a general idea about interpretation of the simulation results. we 4 . Since there are also retransmissions. Although it is a known fact from previous experiences that results of simulation could be different from theory. If the presence of a collision is detected by the sender.Department of CSSE. the total traffic generated is a Poisson process with a mean of G frames per T.1. and let the bandwidth of the medium be Bw (Bytes/sec). This frame can be successfully transmitted if there are no other frames scheduled for transmission between the instants t – T and t + T (this period of duration 2T is called the vulnerable period). it is given by the following equation: T = Sp/Bw. the rate of successful transmission is GPs . the probability Ps of successful transmission is the probability that no frame is transmitted in the interval of length 2T.1.1 The Basic Concept The basic concept of ALOHA is very simple. Therefore. The idea was to use low-cost ham radio-like systems to create a computer network linking the far-flung campuses of the University. We have: Ps = P (no collision) = P (no transmission in two packets time 2T) = e-2G (2-2-1) Since packets are transmitted at a rate of G packets per second with only a fraction Ps successful.1 The Aloha Protocol Aloha was proposed by Abramson in the late 1960’s to enable exchange of messages between remote terminals and the central computer at the University of Hawaii. which might cause several collisions. several packets get corrupted. it transmits the packet right away.

A new or retransmitted frame can be successfully transmitted if there are no other frames scheduled for transmission in T. the rate of successful transmission is G Ps . we get the throughput of slotted ALOHA as S th = Ge − G (2-3-2) This equation gives the channel throughput as a fraction of the offered load. substituting G = ½ in equation (2-2-2). 2. we have S th max = 1 ≈ 0. Auburn University get the throughput of pure ALOHA as S th = Ge −2G (2-2-2) This equation gives the channel throughput as a fraction of the offered load.3 Theoretical Analysis of Slotted ALOHA Slotted Aloha is an improvement of Pure Aloha. we can find the maximum throughput Sth max by differentiating equation (2-3-2) with respect to G and equating to zero as. Therefore. In Slotted ALOHA. we can find the maximum throughput Sth max by differentiating equation (2-2-2) with respect to G and equating to zero as. dS th = −Ge G + e −G = 0 dG (2-3-3) 5 . Therefore. dS th = −2Ge −2G + e −2G = 0 dG (2-2-3) The equation (2-2-3) indicates that the maximum throughput Sth max occurs at the offered load of G = ½. We have: Ps = P (no collision) = P (no transmission in one packets time T) = e −G (2-3-1) Since packets are transmitted at a rate of G packets per second. the stations only transmit at the start of a slotted time which is equal to the transmission time T.4%. Using equation (2-2-2).184 2e (2-2-4) From equation (2-2-4) we can conclude that the maximum throughput Sth max is about 18.If we define the throughput as the fraction of time where the useful information is carried on the channel. Using equation (2-3-2).1.Department of CSSE. the probability Ps of successful transmission is the probability that no frame is transmitted in the transmission time T.

2. Remember that the efficiency is the ratio of successfully used timeslots. substituting G = 1 in equation (2-3-2). that is. where β is the probability of success for a single timeslot. If a collision is heard. the efficiency is k (2-4-1) S th = k+x where x is the expected number of unsuccessful timeslots (collision or empty). Auburn University The equation (2-3-3) indicates that the maximum throughput Sth max occurs at the offered load of G = 1. If every of the N nodes transmits in a given timeslot with probability p: β = Np(1 − p)N−1. Therefore.1 Theoretical Analysis of CSMA/CD Assume that the access medium is partitioned into timeslots and that a packet takes k timeslots to be transmitted.368 e (2-3-4) max From equation (2-3-4) we can conclude that the maximum throughput Sth Slotted Aloha is about 36.8%.2 Carrier Sense Multiple Access with Collision Detection in One of the main drawbacks of ALOHA protocols is that each competing station assumes the medium to be available for transmission irrespective of other participating stations.Department of CSSE. but does not scale efficiently for large number of participant stations. Let Y be a random variable denoting the number of slots until a success: P(Y = m) = β(1−β)m−1. The sender will then continue to listen. This may work efficiently when the number of participating stations is low. all of the colliding stations will stop sending immediately and execute a back-off algorithm to select a later point in time for retransmission. we have S th max = 1 ≈ 0. we get 6 . Y has a geometric distribution with mean E (Y ) = 1 β (2-4-2) Let X be a random variable denoting the number of consecutive wasted slots: X = Y − 1.2. 2. to make sure that sending the data didn’t cause a collision (Collision Detection). When the medium is not busy. To avoid this. the station that wants to send data can do so. and x its mean value: x = E ( X ) = E (Y ) − 1 = 1− β β = 1 − Np (1 − p ) N −1 Np (1 − p ) N −1 (2-4-3) Substituting equation (2-4-3) in equation (2-4-1). CSMA/CD forces stations to “listen” to the channel before sending (Carrier Sensing) in order to make sure that no other station on the wire is sending in the meanwhile.

which is equivalent to maximizing β. By knowing 1 N −1 that (1 − approaches 1/e for N→∞ we can calculate the maximum ) N −1 efficiency as k S th = k + e −1 Efficiency Sth approaches 1 when k→∞. 7 .Department of CSSE. Auburn University S th = k = k+x k 1 − Np (1 − p ) N −1 k+ Np (1 − p) N −1 (2-4-4) Maximising the efficiency is equivalent to minimising x. By differentiating β = Np(1 − p)N−1 with respect to p and equating to zero as dβ Np (1 − p ) N −1 ( N − 1) = N (1 − p ) N −1 − =0 1− p dp (2-4-5) The equation (2-4-5) indicates that the maximum β occurs at the p=1/N.

Keshav (one of the pioneers in developing NS) summarizes the use of Simulation as an analysis tool. Following quote from S. 3. Parameters and Metrics To perform experiments with the simulation tool. The main advantage of simulation is that it allows us to systematically experiment with a wide variety of workloads and statistical parameters. “…However for computer systems. in order to verify the theoretical results.1 Problem Statement The goal of this project is to design and implement a simulation tool and use it to evaluate the performance of the random access protocols under different conditions. we consider that all the stations are sending frames of fixed size Sp.2. The network is connected by shared medium with a bandwidth of Bw. and necessarily so. the theoretical analysis of Pure Aloha is based on the assumption that the frame arrival rate (the new generated frames and the retransmitted frames) is following a Poisson process with a mean of Lambda. Each station in the network will send data (Frames) at a certain rate. But the results obtained as part of the simulation must not be considered as a basis of the real situation. Auburn University 3 Simulation and Analysis 3. we use the same probability distribution. one has to realize that it is a coarse tool. simulations is a reasonable first step (but only the first step). one has to confront the fact that no simulation is ever going to be accurate… But. Therefore. This section describes in detail the experiments performed using the simulator tool and analyzes the results thus obtained. The parameter Lambda of the Poisson process used will have to be determined as the value where the efficiency of the Pure Aloha reaches its maximum.2 Simulation and Analysis of Pure Aloha 3.” The design and implementation details of our simulation tool itself will be presented in Appendix A.Department of CSSE. Also we ensure that the total traffic generated by all the nodes in the network does not exceed the actual bandwidth of the network. As long as you go in with your eyes open. This achieved by dividing the mean frame arrival rate equally among all the nodes of the network. we also evaluate CSMA/CD using the Ns-2 simulator.1 Verification of maximum Link Efficiency of ALOHA As stated in the Chapter 2. Following are the experimental values for the system parameters: Number of stations N = 10 Size of each frame Sp = 10. where a single line of code can completely change the behavior of the system. In order to simplify our analysis.000 Bytes 8 . we consider a network comprising of N stations.

In order to evaluate the performance of our system. Link Efficiency 25 20 Link Efficiency (%) 15 10 5 Figure 1: Finding the value of Lambda that gives a Maximum Efficiency We see that the efficiency reaches its maximum when the value of Lambda is 0.72 1.58 0. Figure 1 shows a graphical plot of efficiency of Pure Aloha in function of Lambda.01 0.2.53 1.29 2.2 Experiments with the simulator The experiments in section demonstrate the impact of each of these parameters on system performance.96 1. 3.48 2.81 Arrival Rate(Lambda) Link Efficiency 9 0 .000 bps With these simulation parameters the experiment is performed for 100 values of Lambda.24 3.Department of CSSE.77 0.2 0.91 2. Auburn University Bandwidth of the shared medium Bw = 56. as percentage of the overall simulation time.05 3. The collision fraction of time.1 2.15 1.67 2. which is computed as the amount of time spent on successful frame transmissions.62 3.34 1. Note that the arrival rate of 0.43 3. We will use this value to generate the cumulative traffic in the network by all the stations for the rest of our simulation experiments. we will have to consider the following metrics: • The Link Efficiency of Pure Aloha.5.39 0. as percentage of the overall simulation • 0.5 is cumulative of all the nodes in the network. which is the amount of time wasted on transmissions that caused collisions.86 3.

Thus experiments are parameterized by N. • The idle fraction of time. as percentage of the overall simulation time. collision fraction. 3. We conclude from the graph that the efficiency is in the range of 18. Sp and Bw.2. Auburn University time. Percentage Collision Time and Percentage Idle Time.e.Department of CSSE.5 The Figure 2 presents the link utilization efficiency over time. Metrics over Time 80 70 60 Percentage 50 40 30 20 10 0. which is computed as the amount of time for which the medium was not utilized.000 bps Lambda = 0.388 1096 2118 3260 4365 5521 6655 7876 9011 10123 11275 12396 13541 14653 15807 16945 18109 19249 20331 21384 Time in seconds Link efficiency Collision Idle 10 0 . Idle fraction and efficiency during the course of simulation.5% over the time. We also plot the collision fraction over the time and the idle fraction of time. Following values are chosen for the system parameters for the experiment. Each experiment is performed by keeping the two of the parameters constant and studying the effect of the other parameter on Link Efficiency.3 Variation of Parameters during simulation The goal of this experiment is to observe the system metrics i. • • • • N = 10 Nodes Sp = 10000 Bytes Bw = 56.

11 . we have set the parameters (N. While in the second side. Auburn University Figure 2: The efficiency. This means that the network has more idle time where no frame is sent. This scenario is because of the low bandwidth and the fixed arrival rate.8%. Indeed.Lambda) as follows: N = 10 Nodes Sp = 10000 Bytes Lambda = 0. collision fraction and idle fraction over time 3.2.Bw.Department of CSSE.Sp. Effect of Bnadwidth on Efficiency 120 100 Percentage (%) 80 60 40 20 1250 8125 15000 21875 28750 35625 42500 49375 56250 63125 70000 76875 83750 90625 97500 1E+05 1E+05 1E+05 1E+05 0 Bandwidth in bps Link Efficiency Collision Duration IdleDuration Figure 3: The effect of varying the bandwidth on the efficiency From the Figure 3. Figure 3 also illustrates the effect of varying the bandwidth on the collision fraction of time. and on the idle fraction of time. which makes collisions to happen more often. we distinguish two sides of the plot: the first is when the efficiency is exponentially increasing until reaching the maximum efficiency which is around 18. when the bandwidth is very low the link experiences a high collision rate and a low idle time rate also.5 The Figure 3 represents the efficiency over the bandwidth.4 Effect of Bandwidth on Link Efficiency In order to understand what should be the effect of varying the bandwidth on the efficiency. as the bandwidth growth the efficiency decreases linearly.

we expect that the impact of the frame size on the efficiency might be similar to the effect of the bandwidth. 3.5 Effect of Frame size on Link Efficiency The frame size and the bandwidth have the inverse impact on the time needed to transmit a frame. Figure 4 illustrates the efficiency over the frame size. 3.2. Indeed.3 Effect of Frame size on Link Efficiency 120 100 Percentage (%) 80 60 40 20 11000 12500 14000 15500 17000 18500 20000 21500 23000 24500 26000 27500 FrameSize in bytes Link Efficiency Collision Duration IdleDuration Figure 4: The effect of varying the frame size on the efficiency In Figure 4 we plot the effect of the frame size variation on the collision fraction of time and on the idle fraction of time.Department of CSSE. Auburn University 3.6 Effect of Number of stations on Link Efficiency The number of nodes in the system has a considerable impact on the metrics of Pure Aloha.3.2. Therefore. 12 29000 2000 3500 5000 6500 8000 9500 500 0 .

we use the same probability distribution.1 Verification of maximum Link Efficiency of ALOHA As stated in the Chapter 2. Therefore. in order to verify the theoretical results. 3.3 Simulation and Analysis of Slotted Aloha 3.3. Auburn University Effect of Number of stations on Link Efficiency 100 90 80 Percentage (% 70 60 50 40 30 20 10 0 11 14 17 20 23 26 29 32 35 Num ber of stations Link Efficiency Collision Duration IdleDuration Figure 5: The effect of varying the number of nodes on the efficiency In Figure 5 we show the effect of varying the number of users on the collision fraction and the idle time fraction over the time. we consider a network comprising of N stations. In order to simplify our analysis. As far as we have simulated the behavior of Pure Aloha protocol under various situations.Department of CSSE.46%. The parameter Lambda of the Poisson process used will have to be determined as the value where the efficiency of the Slotted Aloha reaches its maximum. the theoretical analysis of Slotted Aloha is based on the assumption that the frame arrival rate (the new generated frames and the retransmitted frames) follows a Poisson process with a mean of Lambda. we consider that all the stations are sending frames of fixed size 13 38 2 5 8 . The network is connected by shared medium with a bandwidth of Bw. Parameters and Metrics To perform experiments with the simulation tool. Each station in the network will send data (Frames) at a certain rate. we have noticed that its efficiency is all the time very low around the theoretical value of 18.

3. We will use this value to generate the cumulative traffic in the network by all the stations for the rest of our simulation experiments.3.61 1.01 5.81 6.2 Experiments with the simulator The experiments in section demonstrate the impact of each of these parameters on system performance.41 6.21 3.21 2.81 Percentage Network Load (Lambda) Link Efficiency(%) Figure 6: Finding the value of Lambda that gives a Maximum Efficiency We see that the efficiency reaches its maximum when the value of Lambda is around 1.Department of CSSE.21 5.01 3.81 1.81 4. Figure 1 shows a graphical plot of efficiency of Slotted Aloha in function of Lambda. Note that the arrival rate of 1. This achieved by dividing the mean frame arrival rate equally among all the nodes of the network. Auburn University Sp. Also we ensure that the total traffic generated by all the nodes in the network does not exceed the actual bandwidth of the network.1 is cumulative of all the nodes in the network.1.21 0. Following are the chosen values for the system parameters: Number of stations N = 10 Size of each frame Sp = 7 Kilo Bytes Bandwidth of the shared medium Bw = 56 kbps With these simulation parameters the experiment is performed multiple times increasing the value of lambda each time starting from a small value.41 1.21 6. which is computed as the amount of 14 .21 1.41 3.81 2.41 0.61 4.01 2.81 5. In order to evaluate the performance of our system.21 4.61 0.61 3.01 6. Effect of Network Load on Link Efficiency for Slotted Aloha 45 40 35 30 25 20 15 10 5 0 0.61 6.81 3.41 2.41 5.61 5.01 1.61 2.01 4. we will have to consider the following metrics: • The Link Efficiency of Slotted Aloha.01 0.41 4.

• The collision fraction of time.3 Variation of Parameters during simulation The goal of this experiment is to observe the system metrics i. Sp and Bw. We conclude from the graph that the efficiency is in the range of 37% over the time. which is computed as the amount of time for which the medium was not utilized. Each experiment is performed by keeping the two of the parameters constant and studying the effect of the other parameter on Link Efficiency. Idle fraction and efficiency during the course of simulation.3. • Thus experiments are parameterized by N.Department of CSSE. Following values are chosen for the system parameters for the experiment. • • • • N = 10 Nodes Sp = 7 Kilo Bytes Bw = 56 kbps Lambda = 1. as percentage of the overall simulation time. The idle fraction of time. as percentage of the overall simulation time. We also plot the collision fraction over the time and the idle fraction of time. 3. which is the amount of time wasted on transmissions that caused collisions. Percentage Collision duration and Percentage Idle duration. 15 .1 The Figure 2 presents the link utilization efficiency over time. collision fraction. Auburn University time spent on successful frame transmissions. as percentage of the overall simulation time.e.

we compute first the covariance between X and Y. Y ) = 2 σ xy σ xσ y Variables X and Y are highly correlated since from the samples we have: 16 .Department of CSSE. we statistically analyze the system metrics. Our aim is to find the statistical relations that govern those metrics. efficiency. We consider every metric as a random variable that takes values depending on the MAC protocol used. we generate a population sample of X and Y. In order to study the variations of X in respect of the variations of Y. collision fraction and idle fraction over time Statistical observations In this section.e. and then we compute the coefficient of correlation using the following equation: Correlation( X . Let X be the random variable representing the collision fraction and Y be the idle time fraction. we notice that the shape of the collision fraction is varying in accordance with the shape of the idle time fraction. Using our simulator. Auburn University Variation of Link Efficiency over time 60 50 Percentage (%) 40 30 20 10 0 1 642 1296 1875 2483 3132 3822 4465 5081 5730 6346 7016 7669 8313 8939 9571 10187 10819 11511 12124 12790 13461 14114 14741 15361 15967 16600 17268 17901 18523 19122 19776 20436 21083 21722 22386 23059 Time ( in seconds) Link Efficiency Collision Duration Idle Duration Figure 7: Variation of Link efficiency. we compute the correlation coefficient of the two metrics. Correlation of collision fraction with the idle time fraction From all the Figures of section 3. In order to determine how those two metrics are correlated. We believe there is some information one may infer from observing the behavior of some metrics (i. collision and idle fractions over time).

Lambda) as follows: N = 10 Nodes Sp = 7 Kilo Bytes Lambda = 1.1 The Figure 3 represents the efficiency over the bandwidth. Indeed. From that result we may understand why the efficiency never changes hazardously. 3. Sp.985 ≈ 1 With a correlation of almost 1.3.4 Effect of Bandwidth on Link Efficiency In order to understand what should be the effect of varying the bandwidth on the efficiency. Auburn University Correlation( X . the node 17 . the efficiency remains in a constant state. Bw. However it has to be noted that whenever a packet arrives at the node for transmission. It may seem that in Slotted Aloha the bandwidth has no effect on the link efficiency since the nodes transmit only at the beginning of each slot. we have set the parameters (N. Y ) = 0. when the collision fraction is varying the idle time fraction is varying also in accordance.Department of CSSE. we distinguish two sides of the plot: the first is when the efficiency is exponentially increasing until it reaches the maximum efficiency which is around 37%. Effect of Bandwidth on performance of Slotted Aloha 120 100 Percentage 80 60 40 20 0 12160 16000 19840 23680 27520 31360 35200 39040 42880 46720 50560 54400 58240 62080 65920 69760 73600 77440 81280 85120 88960 92800 96640 4480 8320 640 1E+05 1E+05 1E+05 1E+05 1E+05 1E+05 1E+05 1E+05 Bandwidth (in bps) Link efficiency Collision Duration Idle Duration Figure 8: The effect of varying the bandwidth on the efficiency From the Figure 8. the collision fraction and the idle time fraction are considered highly correlated in other terms.

This is exactly what happens when the bandwidth is low. It may seem that in Slotted Aloha the transmission time has no effect on the link efficiency since the nodes transmit only at the beginning of each slot. and on the idle fraction of time. This increases the chances of collision at the next slot. Effect of FrameSize on performance of Slotted Aloha 100 90 80 70 Percentage 60 50 40 30 20 10 0 51 2 15 36 25 60 35 84 46 08 56 32 66 56 76 80 87 04 97 28 10 75 11 2 77 12 6 80 13 0 82 14 4 84 15 8 87 16 2 89 17 6 92 18 0 94 19 4 96 20 8 99 22 2 01 23 6 04 24 0 06 25 4 08 26 8 11 27 2 13 28 6 16 29 0 18 30 4 20 8 FrameSize (in bits) Link Effificency Collision Duration Idle Duration Figure 9: The effect of varying the frame size on the efficiency 18 . Indeed. Auburn University blocks the transmission until the next time slot. Figure 3 also illustrates the effect of varying the bandwidth on the collision fraction of time. as the bandwidth growth the efficiency decreases linearly. However it has to be noted that whenever a packet arrives at the node for transmission. We plotted the effect of the frame size variation on the collision fraction of time and on the idle fraction of time as shown in Figure below.Department of CSSE. the figure illustrates the dependency of efficiency over the frame size. Therefore. we expect that the impact of the frame size on the efficiency might be similar to the effect of the bandwidth. This increases the number of collisions occurring in the network While in the second side. 3. This implies that if the slot is large then there is a chance that a larger number of stations are likely to transmit at the beginning of the next slot. the node blocks the transmission until the next time slot. This implies that if the slot is large then there is a chance that a larger number of stations are likely to transmit at the beginning of the next slot.5 Effect of Frame size on Link Efficiency The frame size and the bandwidth have inverse impact on the time needed to transmit a frame. Indeed. when the bandwidth is very low the link experiences a high collision rate and a low idle time rate also. In such cases the transmission time is high. This increases the chances of collision at the next slot. This means that the network has more idle time where no frame is sent.3.

Auburn University 3.3.3.8%. we have noticed that its efficiency is all the time very low around the theoretical value of 36. We have also assumed that on occurrence of a collision the nodes involved in collision back off (wait) for a random amount of tie which is exponentially distributed.7 Experiment with different back off distributions In all the experiments until now we assumed that the inter arrival time of packets to be sent over the network is exponentially distributed. In the sections below we experiment with different distributions for the back off period.Department of CSSE.6 Effect of Number of stations on Link Efficiency The number of nodes in the system has a considerable impact on the metrics of Slotted Aloha. As far as we have simulated the behavior of Slotted Aloha protocol under various situations. In Figure 5 we show that the link efficiency Effect of number of stations on performance of Slotted Aloha 120 100 Percentage 80 60 40 20 0 36 38 10 12 14 16 18 20 22 24 26 28 32 30 34 40 2 4 6 8 Number of stations Link Efficiency Collision duration Idle Duration Figure 10: The effect of varying the number of nodes on the efficiency In Figure 5 we show the effect of varying the number of users on the collision fraction and the idle time fraction.7. 3.3. 3. • • N = 10 Nodes Sp = 7 Kilo Bytes 19 .1 Uniform back off distribution In order to study the effect of the uniform back off algorithm on metrics of the system we fix the following parameters. Indeed.

In other words the value of E(X) is unique while the corresponding values of a and b are not. Based on the above argument we perform the simulation experiment starting from a small value of average and repeatedly increasing it for subsequent trials.Department of CSSE. The back off time is a random variable (say X) distributed uniformly between two fixed values a and b which are the parameters of uniform distribution. It is also of interest to find out the values of the parameters of distribution for which the maximum value of Link Efficiency is obtained.1 The aim of the experiment is to study the maximum possible value of Link Efficiency that can be obtained with Uniform back off distribution. Figure 11: Variation of Link Efficiency with Average uniform back-off time From the above figure it can be seen that the maximum possible Link Efficiency that can be obtained using uniform back off algorithm is around 37% and the maximum 20 . By repeating the simulation experiment over a large duration it becomes more relevant to correlate the results obtained to a given value of E(X) than to the parameters a and b themselves. This is because for a given value of E(X) there could be many values of a and b for which a given value of E(X) can occur. Auburn University • • Bw = 56 kbps Lambda = 1. We then identify the value of the average for which the maximum value of Link Efficiency is obtained. Such a random number X has an expected value E(X) given by (a+b)/2. Following graphs depict the results of our experiment.

In other words the Link efficiency is maximum when the number of slots chosen randomly is distributed uniformly over 18 time slots. Following figure shows the variation of Efficiency.e.4 Simulation and Analysis of CSMA/CD In this section we present the simulation results for CSMA/CD The Simulators . the value of parameter b would be 2*9 = 18 i.Department of CSSE. Figure 12: Variation of Link efficiency over time 3. The simulation has been done using both Ns2 and out own simulator. the results do not contradict each other. the maximum efficiency is obtained for a=0 and b=18. It important that however different they are. The default back-off strategy in Ethernet I the 21 . Assuming the least possible value for the parameter a=0. we see that there are differences in the results thus obtained. Although the parameters used for simulations with both the simulators are the essentially the same. The difference in results are mainly due to inherent differences in the underlying implementations of the simulators themselves. Collision duration and Link Efficiency during the course of simulation. Auburn University value is attained for the value 9 of the Average. The Back off Strategies When ever collisions happen in CSMA/CD the colliding stations back-off before retransmitting at a later point in time.

Then it waits for a time K*{2*Tprop} before retransmitting the frame.1023}.2. Each station in the network will send data (Frames) at a certain rate.3} and so on.000 bits • Bandwidth of the shared medium Bw = 10Mbps 22 . The network is connected by shared medium with a bandwidth of Bw. In this case the new node usually grabs the channel first and nodes that have already collided end up giving up after 10 trials. we simulate an “Optimal” back off strategy which is fair to all the stations that are in collision currently with taking history into account.7). we consider a network comprising of N stations. When collision occurs first time a station choose a value K from {0. This is usually an indication that the network is overloaded.1 Verification of maximum Link Efficiency of ALOHA Parameters and Metrics To perform experiments with the simulation tool.2.3. we consider that all the stations are sending frames of fixed size Sp. choose K from {0.1. but the other 100 nodes are in exponential back-off (i =5. In order to simplify our analysis. Since it is impossible to find out the number of participating stations in the collision. In order to over come this. we allow the each station to choose a random number X uniformly distributed between 0 and N. The goal is to adapt retransmission attempts to the estimated current load. 3. the current number of collisions N.….1}. After ten collisions.4. This achieved by dividing the mean frame arrival rate equally among all the nodes of the network. that the station experienced is used as an indicator for N. Stations. Also we ensure that the total traffic generated by all the nodes in the network does not exceed the actual bandwidth of the network. A new node has initial m=0. Considering that there are N such stations. The graphs below show that the efficiencies obtained for optimal back off strategy is definitely more than that for Binary-exponential back-off. However it is with the assumption that each station somehow is able to determine the number of stations involved in collision.6. After second collision: choose K from {0. Auburn University “Binary Exponential” back off.1.4. Following are the experimental values for the system parameters: • Number of stations N = 10 • Size of each frame Sp = 1. Beyond this the station gives up contending for the medium. The Optimal Back-off strategy It is to be noted that the back-off strategy discussed earlier is not necessarily fair.Department of CSSE. Then the station waits for a time X*(2*Tprop) before retransmitting.

1 6. 3 7. 8 6. 4 3. 5 8. 8 0. 2 5. 3 4. 5 2. The dotted line represents the efficiency for Optimal CSMA/CD.Department of CSSE. 6 4. 1 0. 7 4 4. 5 5. 2 2. 4 0. Auburn University • Propagation time τ = 5µs. 9 5. Effect of Offered load on efficiency 100 95 90 Percentage Efficiency 85 80 75 70 65 60 55 50 1 1. 9 8. We can observe that efficiency is about 94% for optimal and 91% for non-optimal. 3 1. 6 7. 1 3. 23 . 4 6. The figure below shows a graphical plot of efficiency of CSMA/CD in function of Rate as obtained using our simulator. 2 8. 8 3. 7 7 7. This is based on the given data that cable length to be used is 1 Km.. Assuming speed of transmission as 2/3rds the speed of light we get τ = 5µs. 9 2. 7 Offered Load Optimal Backoff Binary Backoff Figure 13: Variation of Efficiency of CSMS/CD with Offered Load The figure below depicts the results obtained using Ns2. 6 1.

95 5.03 7.31 1. The same is depicted in the figure below.51 6.29 7.05 1.2 Effect of Bandwidth on efficiency of CSMA/CD Bandwidth plays an important role in deciding the Transmission time required for each station.91 4.33 8.Department of CSSE.47 5.4.81 8.13 3.65 3. 24 . This implies that as ‘a’ increases efficiency decreases.77 7.87 3.17 4.43 4.53 0.85 Offered Load Efficiency Figure 14: Variation of Efficiency of CSMS/CD using NS2 We see that the efficiency increases linearly until the Rate reaches about 2.09 2.000 bits • Bandwidth of the shared medium Bw = Varies from 100Kbps to10Mbps • Propagation time τ = 5µs. E ~ 1/(1+5a) Where a = (Tprop/ Tr).35 2.39 3. and keeps about 94%.55 7.57 1. In other words we can see that (from the above) as bandwidth increases efficiency decreases. Auburn University Variation of Efficiency With Offered Load 100 90 80 70 Efficiency 60 50 40 30 20 10 0 0. Higher the bandwidth the lesser the transmission time. We know from theory that the Efficiency of CSMA/CD is given by.27 0.25 6.01 0.61 2.83 2.99 6.59 8.21 5.07 8.69 4. Parameters: • Number of stations N = 10 • Size of each frame Sp = 1.79 1. 3.73 5.

4 30.2 47.2 33.000 bits • Bandwidth of the shared medium Bw = Varies from 100Kbps to10Mbps • Propagation time τ = 5µs.6 15.81 4.8 32.4.6 36. So in essence this experiment yields results similar to the experiment discussed in section 3.4.8 39.21 5.6 49 Bandwidth (Mbps) Optinal Backoff Binary Backoff NS2 Figure 15: Variation of Efficiency of CSMS/CD with Bandwidth Varying the frame size will have a similar effect on the efficiency of CSMA/CD.01 1. 25 . 3.3 Effect of Number of stations on efficiency of CSMA/CD Increasing the number of participating stations increases the overall load on the network increases.4 16.8 46.4 44.4 23.2 12.8 18.61 7. The graphs below depict the results obtained.6 43.1 above.41 9.6 29.2 26.2 40. Auburn University Effect of Bandwidth on Efficiency 100 90 80 Percentage Efficiency 70 60 50 40 30 20 10 0 0. This is because as per the equations above both bandwidth and frame size eventually affect the value of ‘a’ upon which the efficiency depends.81 14 21 28 35 42 11. Parameters: • Number of stations N = Varies from 2 to100 • Size of each frame Sp = 1.Department of CSSE.8 25.4 37.01 8.41 2.6 22.2 19.

Auburn University Effect of Number of stations on Efficiency 100 90 80 Percentage Efficiency 70 60 50 40 30 20 10 0 23 38 41 44 47 11 14 17 20 65 26 29 32 35 50 53 59 62 68 71 56 80 83 74 77 89 92 95 86 98 5 2 8 Number of Stations Optimal Backoff "Binary Backoff" NS2 Figure 16: Variation of Efficiency of CSMS/CD with number of Stations It is interesting to see that even though the number of stations in the LAN increases to a large value. Even though there are packets in the link layer buffers. This is mainly because of the Carrier Sensing mechanism. 26 . the efficiency of the protocol is not drastically affected unlike in the case of ALOHA. This means that even though MAC layer scales well with the number of stations practical limitations exist due to fixed size network buffers. However the end to end throughput for higher layer protocols reduces due to the limited size of the buffers. thereby avoiding collisions. the protocol will not send frames on to a busy medium.Department of CSSE.

Under similar conditions assumed in theoretical analysis. 18. In the end we also saw the effect of using uniform distribution for variation of the back off time in the case of collisions. the simulation tool shows that the efficiency of Pure Aloha and Slotted Aloha are approximately equal to the corresponding theoretical values i. We have also proposed an optimal back off strategy which yields better results than the default binary exponential back off.our simulator and theory can be mainly attributed to the following: Efficiency of the Random number generator used. Our simulation validates the theoretical results. Auburn University 4 Conclusion In this work we have studied the behavior of different contention based MAC protocols under various network conditions.e.8%. Approximations done as part of theoretical analysis. We have simulated the protocols for different values of the parameters N. Approximations in the calculations done by computer. The difference in the results obtained using NS2. In the final part of the project we studied that the efficiency for CSMA/CD is significantly higher than the Aloha protocols.4% and 36.Department of CSSE. We demonstrated this by showing that the collision fraction of time is highly correlated to the idle time fraction over the time. 27 . Bw and Lambda (Offered Load) using our own simulator and Ns2 as well. It varies anywhere between 80% and 95% for depending on the values of bandwidth. Sp.

e. the simulation tool.1 The Simulation Tool This section describes in detail. • Collision of frames in the shared medium: In the case that a set of nodes send during one transmission time all the sending nodes will get involved in a collision. a Node waits for a randomly distributed time ‘Tg’ before sending a new frame.Department of CSSE.1. Auburn University Appendix A 4. all the nodes will have to back off for a random amount of time before transmitting the same frames again. The time interval between 2 successive frames sent by a Node follows certain random distribution. Indeed. The channel is either busy with transmissions. After each successful transmission. The simulation model used in the simulator is a discrete event simulation model.1 Characterization of the model The simulation model realized in this project can be characterized as follows: • Discrete-state-continuous-time model Although the events happen only at discrete events of time. Probabilistic Model There is a certain degree of randomness in the way the nodes try to access the medium. Further details about the distributions used to model this are mentioned in the next section Open and Dynamic Model The simulation does not make an assumption about the number of frames. 28 . In the case where a frame has to be retransmitted. Therefore. [TBD]The state of the system being simulated varies over time. As part of this model. the state of the shared medium) is defined at all times right through the simulation. the state of the system (i. 4. a node may send frames randomly and continuously into the network. each node in the network has an independent distribution of generating frames. Therefore. the node will have to wait a randomly distributed time Tw(Back off time) before retransmitting. collision or idle. following set of events can be identified: • Transmission of a frame into the shared medium: Nodes transmit frames at a certain rate. implemented as part of this project for experimentation and analysis of ALOHA.

State RandomTgGenerator RandomBkGenerator Member Functions 29 . indicates the state of the current node i.1 Classes Class Node This class represents a single node in the ALOHA network. This is used whenever a node collides. Members Member Variable Description nextTransmitTime indicates the duration after which the next frame will be sent by this node.1.1. Since time is a variable in this setup. The main advantages with Java are: It makes the simulation platform independent and portable. We prefer to have a global variable indicating the current time in the simulation instead of relating it to the actual system time.1. It has rich set of data structures and packages for random number generation. which are in different states at different points of time. Auburn University 4. Whether the current transmission from this node is a fresh transmission or a retransmission of the previous frame. This is the random generator class that is used to generate random time before the next transmission.3 The simulator design The simulator is designed in an object oriented manner. This is the random generator class that is used to generate random time for backing off.Department of CSSE. A global variable in the simulation program is defined and incremented automatically by the time of the next earliest event.e. We need a mechanism to advance the time during simulation. It allows considerable flexibility in modeling the problem at hand. It specifically models the state of the node throughout the simulation. This enables the simulation to perform better by using the CPU in a smarter fashion. 4.3. Following are the classes that are parts of the simulator.2 The simulation language The simulation is done using Java as a programming language. The setup for the simulation mainly consists of the nodes in the networks. as an alternative of not to step through each time unit. 4.

That always the Node at the beginning of the list always transmits next. Auburn University getNextTransmitTime() This function returns the current value of nextTransmitTime.Department of CSSE. Sp 30 . generateBackoff() This function returns the next random amount of time after which the node will transmit the frame. This is vector of Nodes and is used to iterate through the status of each node. This is the size of each frame in bits. generateTg() [TBD: each distribution should have a separate function] This function returns the next random amount of time after which the node will transmit the frame. It models the events that happen during the simulation. Following are the types of events that can happen during the simulation: Frame Transmission Collision Frame Re-Transmission Members: Following are the member variables of the ALOHA. The Nodes are ordered based on their next time of transmission. Class ALOHA This class represents the protocol being simulated. SharedMedium Bw This is the bandwidth (in bits per second) of the medium. Member Variable Description CurrentSimTime: This variable indicates the time at which the an event happened.

Tg 31 . Indicates the number of transmissions that were completed successfully without collision. Auburn University Member Variable Description Tf indicates the transmission time for each node.Department of CSSE. Indicates the amount of time for which the medium was wasted in collision. Indicates the number of retransmissions that occurred during the simulation. BeginSimulation() This function executes the simulation logic for given number of trials. This is the time duration for which the medium is used by the currently transmitting node. Indicates the amount of time for which the medium was idle and was not utilized for transmission by any of the nodes. Increment CurrentSimulationTime to CurrentNode. Following is the algorithm for the function: Function BeginSimulation Begin For trial (0: maxTrials) Begin currentNode = get the first node from the shared medium. If any other node begins to transmit during this time interval a collision will occur. NextNode = get the nect node from the shared medium. Indicates the number of collisions that occurred during the entire length of simulation CollisionDuration IdleTime SuccessCount reTransmitCount CollisionCount Member Functions: GenerateSharedMedium() This function initializes the system by creating all the nodes with initial transmission time. Tf is calculated as the ratio Sp/Bw and is expressed in units of time.

Tg + GenerateBackoff() End for End Function SortMedium() and InsertSorted() This is a helper function for sorting all the nodes based on their next transmission time.Tg currentNode.Tg = nextNode.Tg + Tf >= nextNode.Tg + GenerateBackoff() nextNode. Increment CurrentSimulationTime to nextNode. Auburn University if ( currentNode. DisplayResults () This function displays the results of the simulation based on the final values of the different counters measured right through the simulation. currentNode.Tg = currentNode.Department of CSSE.Tg) Increment collisions count.1.Tg + GenerateBackoff() else Increment success count.Tg = currentNode. 4.4 Source Code 32 .

Sign up to vote on this title

UsefulNot useful- Ns 2 Lab Programs - List
- Docsis Simulator
- P10
- PERFORMANCE EVALUATION OF NS2 AND OMNET++ SIMULATORS FOR AODV PROTOCOL IN MANET
- Services Comparison
- PERFORMANCE EVALUATION OF NS2 AND OMNET++ SIMULATORS FOR AODV PROTOCOL IN MANET
- Tian 1553 sim
- All Optical Networks Presentation - David Payne - 27.09.07
- 12618837_12618837_Pawlikowski
- Bandwidth Allocation for Broadband Transport Network
- Analysis and Enhancement of BWR Mechanism in MAC 802.16 for WIMAX Networks
- mikrotik y mdu
- Utsaf - A Multi-Agent-Based Software Bridge
- Iub Investigation
- IEEE 2014 DOTNET MOBILE COMPUTING PROJECT Bandwidth Recycling in IEEE 802.16 Networks.
- Make My Trip
- PP 95-101 Performance Analysis of Mobile Ad-Hoc Networks HRIDYESH
- Visim Manual
- geni-dce
- Ace Training f
- Dynamic Bandwidth management in Multimedia Applications
- Thesis
- Ns2 Network Simulator- Tutorial for Begineers
- He Idem Ann A
- Network Intrusion Simulation Using OPNET
- BroadBand Config
- NS-2
- ERAN Capacity Monitoring Guide(01)(PDF)-En
- Huawei Vcat Lcas Gmpls
- EIGRP to Remember
- Aloha