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"
|
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-05-08 17:10:06 +02:00
|
|
|
|
|
|
|
run-simulation () {
|
|
|
|
# Generate inputs
|
2021-05-10 10:33:11 +02:00
|
|
|
$scenarios $seed $simtime $wakeupevery $wakeupfor $n_nodes $extended $hint $poff $pon $prx $ptx $datasize $bitrate > "$inputs"
|
2021-05-10 16:03:46 +02:00
|
|
|
|
|
|
|
# Init logs
|
|
|
|
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-08 17:10:06 +02:00
|
|
|
# Run simulations
|
2021-05-10 10:33:11 +02:00
|
|
|
if [ -e "$results" ]
|
|
|
|
then
|
2021-05-10 16:03:46 +02:00
|
|
|
$simulator 2>&1 | tee -a "${log_file}" | $parser | sed 1d | sed "s/$/,${avalues}/" >> "$results"
|
2021-05-10 10:33:11 +02:00
|
|
|
else
|
2021-05-10 16:03:46 +02:00
|
|
|
$simulator 2>&1 | tee -a "${log_file}" | $parser | sed "1 s/$/,${aheaders}/g" | sed "2,\$s/$/,${avalues}/" > "$results"
|
2021-05-10 10:33:11 +02:00
|
|
|
fi
|
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-09 11:07:16 +02:00
|
|
|
wakeupfor=180
|
2021-05-10 10:33:11 +02:00
|
|
|
n_nodes=12
|
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-10 10:33:11 +02:00
|
|
|
datasize=1000000 # MB
|
|
|
|
bitrate="100kbps"
|
2021-05-08 17:10:06 +02:00
|
|
|
|
2021-05-10 10:33:11 +02:00
|
|
|
run-scenarios() {
|
|
|
|
# Configure number of seed per scenarios
|
2021-05-10 11:35:12 +02:00
|
|
|
nseed=100
|
2021-05-10 10:33:11 +02:00
|
|
|
|
|
|
|
# Baseline
|
|
|
|
echo "Baseline..."
|
|
|
|
avalues="baseline,$wireless,$wakeupfor"
|
|
|
|
for seed in $(seq 1 $nseed)
|
|
|
|
do
|
|
|
|
run-simulation
|
|
|
|
done
|
|
|
|
|
|
|
|
# Hint
|
|
|
|
echo "Hint..."
|
|
|
|
hint="true"
|
|
|
|
avalues="hint,$wireless,$wakeupfor"
|
|
|
|
for seed in $(seq 1 $nseed)
|
|
|
|
do
|
|
|
|
run-simulation
|
|
|
|
done
|
|
|
|
hint="false"
|
|
|
|
|
|
|
|
# Extended
|
|
|
|
echo "Extended..."
|
|
|
|
extended="true"
|
|
|
|
avalues="extended,$wireless,$wakeupfor"
|
|
|
|
for seed in $(seq 1 $nseed)
|
|
|
|
do
|
|
|
|
run-simulation
|
|
|
|
done
|
|
|
|
extended="false"
|
|
|
|
|
|
|
|
# Hint+Extended
|
|
|
|
echo "Hint + Extended..."
|
|
|
|
extended="true"
|
|
|
|
hint="true"
|
|
|
|
avalues="hintandextended,$wireless,$wakeupfor"
|
|
|
|
for seed in $(seq 1 $nseed)
|
|
|
|
do
|
|
|
|
run-simulation
|
|
|
|
done
|
|
|
|
extended="false"
|
|
|
|
hint="false"
|
|
|
|
}
|
|
|
|
|
|
|
|
# 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
|
|
|
|
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
|
|
|
|
run-scenarios
|
|
|
|
done
|