loosely-coupled-dss-extended/run_strategy_combined.sh

137 lines
3.2 KiB
Bash
Raw Normal View History

2021-05-08 17:10:06 +02:00
#!/usr/bin/env bash
set -e
wai=$(dirname $(readlink -f "$0"))
2024-06-30 14:49:37 +02:00
scenarios="${wai}/scenarios"
inputs="${wai}/inputs.json"
2024-06-30 14:51:35 +02:00
simulator="make run"
2024-06-30 14:49:37 +02:00
sched="${wai}/analysis/scheduler/analysis.sh"
parser="${wai}/parser.awk"
2024-06-30 15:02:42 +02:00
results="${wai}/results/strategy_combined.csv" # UPDATE HERE TO CHANGE OUTPUT CSV FILE NAME
2021-05-10 10:33:11 +02:00
aheaders="simkey,wireless,wakeupfor"
avalues="none,none,none"
2021-05-10 16:03:46 +02:00
log_file="${wai}/logs/$(date +%s).org" && mkdir -p "${wai}/logs/"
2021-07-02 10:25:56 +02:00
gen_log=0 # Should we generate logs ?
2021-05-08 17:10:06 +02:00
run-simulation () {
# Generate inputs
2021-06-30 15:41:03 +02:00
$scenarios $seed $simtime $wakeupevery $wakeupfor $n_nodes $extended $hint $poff $pon $prx $ptx $datasize $bitrate $hintsize $latency $shutdown_on_rcv $unschedule_on_rcv $farhint $hintdist > "$inputs"
2021-05-10 16:03:46 +02:00
# Init logs
2021-05-11 08:53:11 +02:00
[ $gen_log -eq 1 ] && echo -e "* seed=$seed simtime=$simtime wakeupevery=$wakeupevery wakeupfor=$wakeupfor n_nodes=$n_nodes extended=$extended hint=$hint poff=$poff pon=$pon prx=$prx ptx=$ptx datasize=$datasize bitrate=$bitrate \n" >> "${log_file}"
2021-05-10 16:03:46 +02:00
2021-05-08 17:10:06 +02:00
# Run simulations
2021-06-08 11:59:26 +02:00
tmp=$(mktemp)
$simulator &> $tmp
[ $gen_log -eq 1 ] && cp $tmp "${log_file}"
# Gen csv
[ ! -e "$results" ] && { cat $tmp | $parser | sed "1 s/$/,${aheaders}/g" | sed "2,\$s/$/,${avalues}/" > "$results"; }
[ -e "$results" ] && { cat $tmp | $parser | sed 1d | sed "s/$/,${avalues}/" >> "$results"; }
# Gen scheduler analysis
2021-06-10 17:31:41 +02:00
[ $seed -eq 1 ] && $sched $tmp "logs/$(echo ${avalues}|tr ',' '_')_hint${hint}_extended${extended}.png"
2021-06-08 11:59:26 +02:00
# Clear tmp
rm $tmp
2021-05-08 17:10:06 +02:00
}
# Default Parameters
seed=0
2021-05-10 10:33:11 +02:00
simtime=86400 # One day
wakeupevery=3600
2021-05-12 10:05:19 +02:00
wakeupfor=60
2021-08-24 15:41:17 +02:00
n_nodes=13 # First node will be the sender so n_receivers=n_nodes-1
2021-05-08 17:10:06 +02:00
extended="false"
hint="false"
poff=0
2021-05-09 11:07:16 +02:00
pon=0.4
prx=0.16
ptx=0.16
2021-05-12 10:05:19 +02:00
datasize=1000000 # 1Mb
2021-05-12 10:22:34 +02:00
hintsize=8 # Integer
2021-07-02 10:25:56 +02:00
hintdist=10800 # Hint distance while using farhint
2021-05-14 10:25:51 +02:00
latency=0 # in Seconds
2024-06-30 15:02:42 +02:00
shutdown_on_rcv="true"
unschedule_on_rcv="true"
farhint="true"
2021-05-10 10:33:11 +02:00
bitrate="100kbps"
2021-05-08 17:10:06 +02:00
2021-05-20 07:20:34 +02:00
2021-05-10 10:33:11 +02:00
run-scenarios() {
# Configure number of seed per scenarios
2021-07-02 10:25:56 +02:00
nseed=200
2021-05-10 10:33:11 +02:00
# Baseline
avalues="baseline,$wireless,$wakeupfor"
for seed in $(seq 1 $nseed)
do
2021-05-25 11:53:56 +02:00
printf "\rBaseline...${seed}"
2021-05-10 10:33:11 +02:00
run-simulation
done
2021-05-25 11:53:56 +02:00
echo
2021-05-10 10:33:11 +02:00
# Hint
hint="true"
avalues="hint,$wireless,$wakeupfor"
for seed in $(seq 1 $nseed)
do
2021-05-25 11:53:56 +02:00
printf "\rHint...${seed}"
2021-05-10 10:33:11 +02:00
run-simulation
done
hint="false"
2021-05-25 11:53:56 +02:00
echo
2021-05-10 10:33:11 +02:00
# Extended
extended="true"
avalues="extended,$wireless,$wakeupfor"
for seed in $(seq 1 $nseed)
do
2021-05-25 11:53:56 +02:00
printf "\rExtended...${seed}"
2021-05-10 10:33:11 +02:00
run-simulation
done
extended="false"
2021-05-25 11:53:56 +02:00
echo
2021-05-10 10:33:11 +02:00
# Hint+Extended
extended="true"
hint="true"
avalues="hintandextended,$wireless,$wakeupfor"
for seed in $(seq 1 $nseed)
do
2021-05-25 11:53:56 +02:00
printf "\rHint + Extended...${seed}"
2021-05-10 10:33:11 +02:00
run-simulation
done
extended="false"
hint="false"
2021-05-25 11:53:56 +02:00
echo
2021-05-10 10:33:11 +02:00
}
# Clean previous runs
2021-05-08 17:10:06 +02:00
[ -e "${results}" ] && rm "${results}"
2021-05-10 10:33:11 +02:00
for wakeupfor in 60 180
2021-05-08 17:10:06 +02:00
do
2021-05-10 10:33:11 +02:00
# Lora
2021-05-10 16:03:46 +02:00
echo "----- Run Lora (wakeupfor=$wakeupfor) -----"
2021-05-10 10:33:11 +02:00
wireless="lora"
bitrate="50kbps"
pon=0.4
prx=0.16
ptx=0.16
2021-05-14 10:25:51 +02:00
latency=0
2021-05-10 10:33:11 +02:00
run-scenarios
2021-05-08 17:10:06 +02:00
2021-05-10 10:33:11 +02:00
# NbIot
2021-05-10 16:03:46 +02:00
echo "----- Run NbIoT (wakeupfor=$wakeupfor) -----"
2021-05-10 10:33:11 +02:00
wireless="nbiot"
bitrate="200kbps"
pon=0.4
prx=0.65
ptx=0.65
2021-06-17 10:34:07 +02:00
latency=0
2021-05-10 10:33:11 +02:00
run-scenarios
2024-06-30 14:49:37 +02:00
done