# Slotted ALOHA :::success - [x] Step 1: Background knowledge (with text and figures) * [x] Step 2: System model (I/P parameters, system architecture and timing diagram) * [x]Step 3a: Specify the constant * [ ]Step 3b: Draw a timing diagram showing the transmission behavior of a STA * [x] Step 4: Simulator (Data structure, flowchart) * [ ]Step 5: Verification of values generated from the simulator and Step 3b * [x]Step 6: Simulation results ::: ## Step 1: Background Knowledge :::info Summarize the background knowledge (with text and figures) ::: - **In slotted ALOHA**, time is assumed to be slotted in timeslots of duration $τ$, and STAs can only start their packet transmissions at the beginning of the next timeslot after the packet has formed ![](https://i.imgur.com/NJDP2NF.jpg) - Each STAs can have two states: ***idle*** or ***backlogged***. - When a STA has nothing to transmit it is in the idle state. - If the packet was received successfully the STA enters the idle state again, *otherwise* it goes to backlogged state. :::success ***Idle State*** - As there are a total of $m$ STAs in the network, each of the $m−n$ nonbacklogged STAs will transmit a packet **immediately** in the given slot if one or more packets arrived at these STAs - These new arrivals are Poisson distributed with mean $λ$, so probability of no arrivals is $e^{-λ/m}$ - This implies that the probability of an unbacklogged STA transmits packets in a given slot is $P_a = 1-e^{-λ/m}$ ::: :::success ***Backlogged state*** - Each backlogged STAs retransmits with probability $P_r$ in each successive slot until successful transmission happens - Let $n$ denote the number of backlogged STAs at the beginning of a given slot, each of the STAs will transmit a packet in a given slot independent of the other nodes, with probability $P_r$ ::: - $G=λτ$ is offered load, and throughput $S=Ge^{-G}$ - Collision Probability $P_c=1-Ge^{-G}-e^{-G}$ - Mean delay $\overline{D_{}}=1-{1/λ}+{m/S}$ ## Step 2: System Model :::info Define the problem by specifying the system model you considered ::: - There are m STAs, - Time is divided into fixed-length slots - Packet arrivals are poisson distribution with mean $λ$ - When STAs are in the idle state, probability of new arrival for each STAs is $P_a = 1-e^{-λ/m}$ - When in backlogged state, probability of retransmission is $P_r=P_a = 1-e^{-λ/m}$ - An STA will stay in backlogged state until the packet is successful, when the packet is successful STA will become idle and waiting for a new packet arrival ![](https://i.imgur.com/liwjq8s.jpg) *Figure 2.1 Timing Diagram* ## Step 3: Draw figures to show the concepts you learned ### 3a. Specify the constants you used in the figures :::info specify I/P parameters ::: | I/P | Value | | -------- | -------- | | number of STAs | 100 | | $λ$ | [0:0.1:5] | | simulation Time | $10^5$ timeslots | ### 3b. Draw a timing diagram showing the transmission behavior of a STA :::info Draw a timing dirgram showing the concepts you learned ::: ## Step 4 : Simulator :::info Write a simulator to verify the concept ::: ### 4a. Define the parameters (their ranges need to be specified) and data structures to be used in your simulator #### STA's Data structure | datatype | meaning | range | | -------- | -------- | -------- | | int[status]| STA status, idle or backlogged | $[0,1]$ | | float[pa] | packet arrival probability | $[0,1]$ | | float[pr] | packet retransmission probability | $[0,1]$ | |int[N] | packet transmitted in a given slot|$[0,100]$ | | int[totalPacketAt] |total packets attempted| | | int[totalPacketTr] |total packets successfully transmitted| | |O/P| |-|-| |$p$ : packet collision probability | |$S$ : throughput | |$G$ : offered load | |$\overline{D_{}}$ : mean delay | ### 4b. Draw the flowchart ![](https://i.imgur.com/zttUK4e.jpg) ## Step 5 : Verification :::info Implement a simulator. Use the values you generated from the simulator and verified them one-by-one based on Step 3 ::: >this is the transmission behavior when lambda=1 https://raw.githubusercontent.com/bariqfirmansyah/slottedaloha/master/lambda1.txt this is also the transmission behavior when lambda=1 https://raw.githubusercontent.com/bariqfirmansyah/slottedaloha/master/lambda1a.txt this is the transmission behavior when lambda=5 https://raw.githubusercontent.com/bariqfirmansyah/slottedaloha/master/lambda5.txt >look at how the packet transmission occurs more when lambda=5 ## Step 6 : Simulation Result :::info Show us the simulation results ::: ![](https://i.imgur.com/wjZ7fCZ.jpg) ![](https://i.imgur.com/wLf87aX.jpg) ![](https://i.imgur.com/YoBk17h.jpg)