forked from imec-idlab/IEEE-802.11ah-ns-3
-
Notifications
You must be signed in to change notification settings - Fork 0
/
optimal-RAW-algorithm-fixedraw.sh
executable file
·118 lines (72 loc) · 3.95 KB
/
optimal-RAW-algorithm-fixedraw.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
#!/bin/bash
if [ $# -ne 5 ]
then
echo "parameters missing"
exit 1
fi
# main function (loop)
# 0. balance station with one RAW group and run ns-3 simluation.
# 1. read file get throughput, delay and idle time,
# increase/decrease RAW groups, or get the optimal one and stop programming
# 2. reblance RAW
# 3. run ns-3 simulation, go back to function 1
# ./waf --run "s1g-mac-test --seed=$seed --simulationTime=$simTime --payloadSize=256 --Nsta=$totalSta --NRawSta=$totalRawstas BeaconInterval=$BeaconInterval --DataMode=$DataMode --datarate=$datarate --bandWidth=$bandWidth --rho=$rho --folder=$folder --file=$file --pcapfile=$pcapf" #> ./TestMacresult-s1g/mode0/test$trial/traffic-$UdpInterval/pcap-sta-$NumSta/$NGroup-groups-$NRawSlotNum-slots/record-$NumSta-$NGroup.txt 2>&1
seed=$1
NumSta=$2
traffic=$3
payloadSize=256
NRawGroups=$4 #one raw group occupying the whole beacon
NumSlot=$5
simTime=100
BeaconInterval=102400
DataMode="MCS2_0"
datarate=7.8
bandWidth=2
S1g1MfieldEnabled=false
udpStart=0
udpEnd=$(($NumSta - 9))
tcpipcameraStart=$(($NumSta - 8))
tcpipcameraEnd=$(($NumSta - 1))
#at least one udp
rho="50"
echo $seed
echo $NumSlot
totalSta=$NumSta
totalRawstas=$NumSta
if [ ! -d OptimalRawGroup/ ]
then
mkdir OptimalRawGroup/
fi
if [ ! -d OptimalRawGroup/traffic-$traffic/ ]
then
mkdir OptimalRawGroup/traffic-$traffic/
fi
if [ ! -d OptimalRawGroup/traffic-$traffic/ ]
then
mkdir OptimalRawGroup/traffic-$traffic/
fi
if [ ! -d OptimalRawGroup/traffic-$traffic/NRawGroups$NRawGroups-NumSlot$NumSlot ]
then
mkdir OptimalRawGroup/traffic-$traffic/NRawGroups$NRawGroups-NumSlot$NumSlot
fi
if [ ! -d OptimalRawGroup/traffic-$traffic/NRawGroups$NRawGroups-NumSlot$NumSlot/simResult-$NumSta-seed$seed ]
then
mkdir OptimalRawGroup/traffic-$traffic/NRawGroups$NRawGroups-NumSlot$NumSlot/simResult-$NumSta-seed$seed/
fi
if [ ! -d OptimalRawGroup/traffic-$traffic/NRawGroups$NRawGroups-NumSlot$NumSlot/simResult-$NumSta-seed$seed/ ]
then
mkdir OptimalRawGroup/traffic-$traffic/NRawGroups$NRawGroups-NumSlot$NumSlot/simResult-$NumSta-seed$seed/
else
rm -rf OptimalRawGroup/traffic-$traffic/NRawGroups$NRawGroups-NumSlot$NumSlot/simResult-$NumSta-seed$seed/
mkdir OptimalRawGroup/traffic-$traffic/NRawGroups$NRawGroups-NumSlot$NumSlot/simResult-$NumSta-seed$seed/
fi
Outputpath="./OptimalRawGroup/traffic-$traffic/NRawGroups$NRawGroups-NumSlot$NumSlot/simResult-$NumSta-seed$seed/"
TrafficPath="./OptimalRawGroup/traffic/data-$NumSta-$traffic.txt"
touch ./OptimalRawGroup/traffic-$traffic/NRawGroups$NRawGroups-NumSlot$NumSlot/simResult-$NumSta-seed$seed/simlog.txt
RAWConfigFile="./OptimalRawGroup/RawConfig-$NumSta-$NRawGroups-$NumSlot.txt"
if [ ! -f OptimalRawGroup/RawConfig-$NumSta-$NRawGroups-$NumSlot.txt ]
then
./waf --run "RAW-generate --NRawSta=$NumSta --NGroup=$NRawGroups --NumSlot=$NumSlot --RAWConfigPath=$RAWConfigFile --beaconinterval=$BeaconInterval"
fi
#./waf --run "test --seed=$seed --simulationTime=$simTime --payloadSize=$payloadSize --Nsta=$totalSta --NRawSta=$totalRawstas --BeaconInterval=$BeaconInterval --DataMode=$DataMode --datarate=$datarate --bandWidth=$bandWidth --rho=$rho --TrafficPath=$TrafficPath --S1g1MfieldEnabled=$S1g1MfieldEnabled --RAWConfigFile=$RAWConfigFile --NRawSlotNum=$NumSlot --NGroup=$NRawGroups --totaltraffic=$traffic --tcpipcameraStart=$tcpipcameraStart --tcpipcameraEnd=$tcpipcameraEnd --udpStart=$udpStart --udpEnd=$udpEnd" #> ./OptimalRawGroup/traffic-$traffic/NRawGroups$NRawGroups-NumSlot$NumSlot/simResult-$NumSta-seed$seed/simlog.txt 2>&1
./waf --run "test --seed=$seed --simulationTime=$simTime --payloadSize=$payloadSize --Nsta=$totalSta --NRawSta=$totalRawstas --BeaconInterval=$BeaconInterval --DataMode=$DataMode --datarate=$datarate --bandWidth=$bandWidth --rho=$rho --Outputpath=$Outputpath --S1g1MfieldEnabled=$S1g1MfieldEnabled --RAWConfigFile=$RAWConfigFile --TrafficPath=$TrafficPath" > ./OptimalRawGroup/traffic-$traffic/NRawGroups$NRawGroups-NumSlot$NumSlot/simResult-$NumSta-seed$seed/simlog.txt 2>&1