Files
WirelessNetworkingTechnologies/lab_2/Slotted_Aloha_Report.md
T
2026-05-08 14:07:45 +02:00

68 lines
3.0 KiB
Markdown

# Simulation of Slotted ALOHA Throughput Report
**Timo Niemann**
## Goal
The goal of this simulation is to analyze the throughput behavior of Slotted ALOHA for a fixed number of senders. For every access probability `p`, each sender independently decides whether to transmit in the current time slot. A slot is successful only if exactly one sender transmits. Empty slots and collisions do not contribute to the throughput.
## Simulation Setup
| Parameter | Value |
|---|---|
| `number_of_senders` | `4` |
| `number_of_timeslots` | `1000` |
| `access_probability` | `0:0.01:1` |
| slot result | `1 = successful transmission`, `0 = no successful transmission` |
## Throughput Formula
For `n` independent senders, the theoretical throughput is the probability that exactly one sender transmits in a slot:
```text
throughput = np(1 - p)^(n - 1)
```
With `n = 4`, this becomes:
```text
throughput = 4p(1 - p)^3
```
The theoretical maximum is reached at:
```text
p = 1 / n = 0.25
```
Therefore, the maximum theoretical throughput is:
```text
throughput(0.25) = 4 * 0.25 * 0.75^3 = 0.421875
```
## Throughput Curve Plot
![Simulated and theoretical throughput curve for four senders](SlottedAloha.svg)
**Figure 1:** Simulated and theoretical throughput curve for four senders.
## Maximum Coordinates
| Curve | Maximum coordinate |
|---|---|
| Theoretical | `p = 0.25`, throughput `= 0.421875` |
| Simulation | approximately `p = 0.28` to `0.30`, throughput `≈ 0.43` in the shown run |
## Comparison with the Theoretical Formula
The theoretical curve is smooth because it is calculated directly from the probability formula. The simulated curve follows the same overall shape, but it is not perfectly smooth because only `1000` time slots are simulated for each probability value. Therefore, random variation is still visible.
The important behavior matches the theory. At low access probabilities, the throughput is low because most slots are empty. As `p` increases, successful transmissions become more likely and the throughput rises. Around `p = 0.25`, the system reaches its best operating region. After that point, too many senders transmit in the same slot, so collisions become more frequent and the throughput decreases.
The simulated maximum is slightly shifted and slightly higher than the theoretical maximum in the shown run. This is expected for a finite simulation. With more time slots per probability value, the simulated curve should become smoother and the maximum should move closer to the theoretical coordinate `p = 0.25`, `S = 0.421875`.
## Conclusion
The simulation correctly reproduces the characteristic Slotted ALOHA throughput curve. The best throughput is obtained when the access probability is close to `1 / n`. For four senders, this is `p = 0.25`. Below this value, the channel is underused. Above this value, collisions dominate increasingly. The comparison shows that the implementation is consistent with the theoretical formula, while the visible deviations are caused by finite random sampling.