Skip to content

Instantly share code, notes, and snippets.

@songritk
Last active November 29, 2017 16:43
Show Gist options
  • Save songritk/8ca1f7fea501a7dab3dc88dab95c5a50 to your computer and use it in GitHub Desktop.
Save songritk/8ca1f7fea501a7dab3dc88dab95c5a50 to your computer and use it in GitHub Desktop.
ทดสอบ rtt, mcs เมื่อเปิด AMC
#!/bin/bash
# Default Parameter
#Program Arguments:
# --staManager: PRC Manager of the STA [ns3::MinstrelHtWifiManager]
# --apManager: PRC Manager of the AP [ns3::MinstrelHtWifiManager]
# --shortGuardInterval: Enable Short Guard Interval in all stations [false]
# --channelWidth: Channel width of all the stations [20]
# --STmcs: STmcs index [0]
# --Rmcs: STmcs index [0]
# --rtsThreshold: RTS threshold [65535]
# --BE_MaxAmpduSize: BE MAC A-MPDU size [1500]
# --outputFileName: Output filename [a1-amc]
# --steps: How many different distances to try [10]
# --stepsTime: Time on each step [1]
# --stepsSize: Distance between steps [1]
# --Sx: Position of STA1 in x coordinate [-20]
# --Sy: Position of STA1 in y coordinate [0]
# --Rx: Position of RogueX in x coordinate [1900]
# --Ry: Position of RogueY in y coordinate [2000]
# --Ax: Position of AP1 in x coordinate [0]
# --Ay: Position of AP1 in y coordinate [0]
# --payloadSize: payloadSize [1472]
# --APPrate: APPrate [0.1167]
# --nNodeR: nNodeR [1]
# --distRBG: distRBG [5000]
# --RBGPktSize: RBGPktSize [1472]
# --RBGrate: RBGrate [0.0001]
# --nNodeA: nNodeA [1]
# --distABG: distABG [5000]
# --ABGPktSize: ABGPktSize [1472]
# --ABGrate: ABGrate [0.0001]
# --pcap: pcap [true]
# --throughput: throughput measurement [false]
# --Rtx: Rogue Tx power [16.0206]
# --Rng: Rng [12]
# --AMC: Enable AMC [true]
SX=`seq -1000 10 0`
Sy=0
Ax=0
Ay=0
Rx=1900
Ry=1900
RNG=`seq 2 1 35`
for Rng in $RNG; do
for Sx in $SX; do
rm -f *.pcap
rm -f rtt.txt
./waf --run "a1-amc --Rng=$Rng --Sx=$Sx"> rtt.txt
npkt=`grep 'packets transmitted' rtt.txt|awk '{print $1}'`
rpkt=`grep 'packets transmitted' rtt.txt|cut -d, -f2 |awk '{print $1}'`
pktloss=`grep 'packets transmitted' rtt.txt|cut -d, -f3 |awk '{print $1}'`
rtt=`grep 'rtt min/avg/max/mdev' rtt.txt |awk '{print $4}'|awk -F/ '{print $2}'`
mdev=`grep 'rtt min/avg/max/mdev' rtt.txt |awk '{print $4}'|awk -F/ '{print $4}'`
ssi=`tshark -r a1-amc-1-0.pcap -Y'wlan.fc == 0x8000' -z 'proto,colinfo,wlan_radio.signal_dbm,wlan_radio.signal_dbm'|awk '{ sum += $18; n++ } END { if (n > 0) print sum / n; }'`
mcs=`tshark -r a1-amc-1-0.pcap -Y 'icmp' -z 'proto,colinfo,wlan_radio.11ac.mcs,wlan_radio.11ac.mcs'|awk '{ sum += $17; n++ } END { if (n > 0) print sum / n; }'`
echo "$Rng 1HOP $Sx $Sy $Rx $Ry $Ax $Ay $mcs $ssi $rtt"
done;done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment