Last active
April 28, 2023 09:36
-
-
Save SzymonSzott/5ba70ef55ba2effe0b388dfb0020f036 to your computer and use it in GitHub Desktop.
Wi-Fi collision probability in ns-3
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| Nsta=3 #Number of Wi-Fi stations | |
| export 'NS_LOG=HeFrameExchangeManager'; #Enable logging (change FrameExchangeManager accordingly) | |
| ./waf --run "scratch/skrypt --Nsta=$Nsta" &> output.log #Run simulation | |
| cat output.log | grep StartFrameExchange > output-tx.log #Store log of all TX attempts | |
| cat output.log | grep "receive ack" > output-rx.log #Store log of all successful TXs #TODO: update this line to latest ns-3 | |
| # Calculate per-station statistics | |
| for i in `seq 1 $Nsta` | |
| do | |
| mac=$(printf '%02x\n' $i) | |
| tx[$i]=$(cat output-tx.log | grep mac=00:00:00:00:00:$mac | wc -l) | |
| rx[$i]=$(cat output-rx.log | grep mac=00:00:00:00:00:$mac | wc -l) | |
| echo $i,${tx[$i]},${rx[$i]} >> results.csv #Station ID, number of TX attempts, number of successful TXs | |
| done | |
| unset NS_LOG |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment