loosely-coupled-dss-extended/results/paper_.sh

89 lines
2.1 KiB
Bash
Raw Normal View History

2021-05-31 08:16:09 +02:00
#!/usr/bin/env bash
set -e
wai=$(dirname $(readlink -f "$0"))
scenarios="${wai}/../scenarios"
inputs="${wai}/../inputs.json"
simulator="make -C ${wai}/../ run"
2021-06-10 17:31:41 +02:00
sched="${wai}/scheduler/analysis.sh"
2021-05-31 08:16:09 +02:00
parser="${wai}/../parser.awk"
2021-06-10 17:31:41 +02:00
results="${wai}/results.csv"
2021-05-31 08:16:09 +02:00
aheaders="simkey,wireless,wakeupfor"
avalues="none,none,none"
2021-06-10 17:31:41 +02:00
log_file="${wai}/logs/$(date +%s).org" && mkdir -p "${wai}/logs/"
gen_log=0 # Should we generate logs ?
2021-05-31 08:16:09 +02:00
run-simulation () {
# Generate inputs
$scenarios $seed $simtime $wakeupevery $wakeupfor $n_nodes $extended $hint $poff $pon $prx $ptx $datasize $bitrate $hintsize $latency > "$inputs"
# Init logs
[ $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-06-10 17:31:41 +02:00
# Run simulations
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
#[ $seed -eq 1 ] && $sched $tmp "logs/$(echo ${avalues}|tr ',' '_')_hint${hint}_extended${extended}.png"
# Clear tmp
cat $tmp
rm $tmp
2021-05-31 08:16:09 +02:00
}
# Default Parameters
2021-06-10 17:31:41 +02:00
seed=0
2021-05-31 08:16:09 +02:00
simtime=86400 # One day
wakeupevery=3600
wakeupfor=60
2021-06-10 17:31:41 +02:00
n_nodes=13
2021-05-31 08:16:09 +02:00
extended="false"
hint="false"
poff=0
pon=0.4
prx=0.16
ptx=0.16
datasize=1000000 # 1Mb
hintsize=8 # Integer
latency=0 # in Seconds
bitrate="100kbps"
run-scenarios() {
# Configure number of seed per scenarios
2021-06-10 17:31:41 +02:00
nseed=200
2021-05-31 08:16:09 +02:00
2021-06-10 17:31:41 +02:00
# Baseline
avalues="baseline,$wireless,$wakeupfor"
for seed in 17
2021-05-31 08:16:09 +02:00
do
2021-06-10 17:31:41 +02:00
printf "\rBaseline...${seed}"
2021-05-31 08:16:09 +02:00
run-simulation
done
echo
}
# Clean previous runs
[ -e "${results}" ] && rm "${results}"
for wakeupfor in 60
do
# Lora
echo "----- Run Lora (wakeupfor=$wakeupfor) -----"
wireless="lora"
bitrate="50kbps"
pon=0.4
prx=0.16
ptx=0.16
latency=0
2021-06-08 09:58:37 +02:00
run-scenarios
2021-06-10 17:31:41 +02:00
done