Skip to content

Instantly share code, notes, and snippets.

@songritk
Created January 8, 2018 07:55
Show Gist options
  • Save songritk/d472de8440fc64047f47336db9a79801 to your computer and use it in GitHub Desktop.
Save songritk/d472de8440fc64047f47336db9a79801 to your computer and use it in GitHub Desktop.
ที่มาไฟล์ data-5-10-250.csv
#!/bin/bash
RNG="11"
RTx="5 10 15 20"
#RTx="16 17 18 19 20"
## Box1
sX=`seq 0 10 600`
sY=`seq 0 10 600`
rX="150 180 190 200 210 220 230 240 250 260 270"
rY="300"
aX="300"
aY="300"
PktSize="1472"
PKTrate="1"
#nBGR="1 2 4"
nBGR="1"
dRBG="5"
rBGPktSize="576"
rBGrate="10"
#nBGA="1 2 4"
nBGA="1"
dABG="5"
aBGPktSize="576"
aBGrate="10"
#aBGrate="1"
DIR="11ac-rx"
DATE=`date +"%Y%m%d-%H%M%S"`
mkdir -p $DIR/$DATE
rm -f *.txt
rm -f *.pcap
for rng in $RNG
do
mkdir $DIR/$DATE/$rng
for rTx in $RTx
do
for Sx in $sX
do
for Sy in $sY
do
for Rx in $rX
do
for Ry in $rY
do
for Ax in $aX
do
for Ay in $aY
do
for payloadSize in $PktSize
do
for pktrate in $PKTrate
do
for nNodeR in $nBGR
do
for distRBG in $dRBG
do
for RBGPktSize in $rBGPktSize
do
for RBGrate in $rBGrate
do
for nNodeA in $nBGA
do
for distABG in $dABG
do
for ABGPktSize in $aBGPktSize
do
for ABGrate in $aBGrate
do
rm -f *.txt
rm -f *.pcap
./waf --run "vht5-R --Sx=$Sx --Sy=$Sy
--Rtx=$rTx
--Rx=$Rx --Ry=$Ry
--Ax=$Ax --Ay=$Ay
--payloadSize=$payloadSize
--pktrate=$pktrate
--nNodeR=$nNodeR
--distRBG=$distRBG
--RBGPktSize=$RBGPktSize
--RBGrate=$RBGrate
--nNodeA=$nNodeA
--distABG=$distABG
--ABGPktSize=$ABGPktSize
--ABGrate=$ABGrate
--RngRun=$rng" > rtt.txt
nTx=""
nRx=""
rtt=""
sICMP=""
nTx=`grep "packets transmitted" rtt.txt |awk '{print $1}'`
nRx=`grep "packets transmitted" rtt.txt |awk '{print $4}'`
rtt=`cat rtt.txt|grep "rtt min/avg/max/mdev"|awk '{print $4}'|awk -F'/' '{print $1,$2,$3,$4}'`
if [ -z $nTx ]; then
nTx=0
fi
if [[ $nRx -eq 0 ]]; then
sICMP="0 no-ICMP"
fi
if [[ -z $rtt ]]; then
rtt="0"
fi
if [[ $sICMP == "" ]]; then
##FromDS-ICMP : S
tshark -z 'proto,colinfo,radiotap.dbm_antsignal,radiotap.dbm_antsignal' -z 'proto,colinfo,radiotap.vht.mcs.0,radiotap.vht.mcs.0' -z 'proto,colinfo,wlan_radio.noise_dbm,wlan_radio.noise_dbm' -z 'proto,colinfo,wlan_radio.data_rate,wlan_radio.data_rate' -z 'proto,colinfo,wlan.duration,wlan.duration' -Y'wlan.fc.type==2' -Y'wlan.fc.ds == 0x02 && !(llc.type == 0x0806)&&icmp' -r vht5-R-1-0.pcap|sed 's/Len=//g'|awk '{print $3,$5,$7,$16,$19,$22,$25,$28}' > s-icmp.txt
if [[ -s s-icmp.txt ]]; then
sICMP=`Rscript utils/stat.R s-icmp.txt`
fi
fi
echo "2HOP-R $Sx $Sy $Rx $Ry $Ax $Ay AMC $payloadSize $pktrate $nNodeR $distRBG $RBGPktSize $RBGrate $nNodeA $distABG $ABGPktSize $ABGrate, $nTx $nRx $rtt, $sICMP, $rTx" >> $DIR/$DATE/$rng/$DATE-lab.txt
rm -f *.txt
rm -f *.pcap
./waf --run "vht5-A --Sx=$Sx --Sy=$Sy
--Rtx=$rTx
--Rx=$Rx --Ry=$Ry
--Ax=$Ax --Ay=$Ay
--payloadSize=$payloadSize
--pktrate=$pktrate
--nNodeR=$nNodeR
--distRBG=$distRBG
--RBGPktSize=$RBGPktSize
--RBGrate=$RBGrate
--nNodeA=$nNodeA
--distABG=$distABG
--ABGPktSize=$ABGPktSize
--ABGrate=$ABGrate
--RngRun=$rng" > rtt.txt
nTx=""
nRx=""
rtt=""
sICMP=""
nTx=`grep "packets transmitted" rtt.txt |awk '{print $1}'`
nRx=`grep "packets transmitted" rtt.txt |awk '{print $4}'`
rtt=`cat rtt.txt|grep "rtt min/avg/max/mdev"|awk '{print $4}'|awk -F'/' '{print $1,$2,$3,$4}'`
if [ -z $nTx ]; then
nTx=0
fi
if [[ $nRx -eq 0 ]]; then
sICMP="0 no-ICMP"
fi
if [[ -z $rtt ]]; then
rtt="0"
fi
if [[ $sICMP == "" ]]; then
##FromDS-ICMP : S
tshark -z 'proto,colinfo,radiotap.dbm_antsignal,radiotap.dbm_antsignal' -z 'proto,colinfo,radiotap.vht.mcs.0,radiotap.vht.mcs.0' -z 'proto,colinfo,wlan_radio.noise_dbm,wlan_radio.noise_dbm' -z 'proto,colinfo,wlan_radio.data_rate,wlan_radio.data_rate' -z 'proto,colinfo,wlan.duration,wlan.duration' -Y'wlan.fc.type==2' -Y'wlan.fc.ds == 0x02 && !(llc.type == 0x0806)&&icmp' -r vht5-A-1-0.pcap|sed 's/Len=//g'|awk '{print $3,$5,$7,$16,$19,$22,$25,$28}' > s-icmp.txt
if [[ -s s-icmp.txt ]]; then
sICMP=`Rscript utils/stat.R s-icmp.txt`
fi
fi
echo "1HOP-A $Sx $Sy $Rx $Ry $Ax $Ay AMC $payloadSize $pktrate $nNodeR $distRBG $RBGPktSize $RBGrate $nNodeA $distABG $ABGPktSize $ABGrate, $nTx $nRx $rtt, $sICMP, $rTx" >> $DIR/$DATE/$rng/$DATE-lab.txt
rm -f *.txt
rm -f *.pcap
done
done
done
done
done
done
done
done
done
done
done
done
done
done
done
done
done
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment