2021-05-08 17:10:06 +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"
|
|
|
|
parser="${wai}/../parser.awk"
|
|
|
|
results="${wai}/results.csv"
|
|
|
|
nseed=10
|
|
|
|
|
|
|
|
run-simulation () {
|
|
|
|
# Generate inputs
|
|
|
|
$scenarios $seed $simtime $maxstartupdelay $wakeupevery $wakeupfor $n_nodes $extended $hint $poff $pon $prx $ptx $datasize $simkey > "$inputs"
|
|
|
|
# Run simulations
|
|
|
|
[ -e "$results" ] && { $simulator 2>&1 | $parser | sed 1d >> "$results"; } || { $simulator 2>&1 | $parser > "$results"; }
|
|
|
|
}
|
|
|
|
|
|
|
|
# Default Parameters
|
|
|
|
seed=0
|
|
|
|
simtime=100
|
|
|
|
maxstartupdelay=1
|
|
|
|
wakeupevery=10
|
|
|
|
wakeupfor=10
|
|
|
|
n_nodes=1
|
|
|
|
extended="false"
|
|
|
|
hint="false"
|
|
|
|
poff=0
|
|
|
|
pon=1
|
|
|
|
prx=1
|
2021-05-08 21:38:26 +02:00
|
|
|
ptx=2
|
2021-05-08 17:10:06 +02:00
|
|
|
datasize=1
|
|
|
|
simkey=0
|
|
|
|
|
|
|
|
# Baseline
|
|
|
|
echo "Baseline..."
|
|
|
|
[ -e "${results}" ] && rm "${results}"
|
|
|
|
simkey="baseline"
|
|
|
|
for seed in $(seq 1 $nseed)
|
|
|
|
do
|
|
|
|
run-simulation
|
|
|
|
done
|
|
|
|
|
|
|
|
# Hint
|
|
|
|
echo "Hint..."
|
|
|
|
hint="true"
|
|
|
|
simkey="hint"
|
|
|
|
for seed in $(seq 1 $nseed)
|
|
|
|
do
|
|
|
|
run-simulation
|
|
|
|
done
|
|
|
|
hint="false"
|
|
|
|
|
|
|
|
# Extended
|
|
|
|
echo "Extended..."
|
|
|
|
extended="true"
|
|
|
|
simkey="extended"
|
|
|
|
for seed in $(seq 1 $nseed)
|
|
|
|
do
|
|
|
|
run-simulation
|
|
|
|
done
|
|
|
|
extended="false"
|
|
|
|
|
|
|
|
# Hint+Extended
|
|
|
|
echo "Hint + Extended..."
|
|
|
|
extended="true"
|
|
|
|
hint="true"
|
|
|
|
simkey="hintandextended"
|
|
|
|
for seed in $(seq 1 $nseed)
|
|
|
|
do
|
|
|
|
run-simulation
|
|
|
|
done
|
|
|
|
extended="false"
|
|
|
|
hint="false"
|