Cleaning repository

This commit is contained in:
Loïc Guégan 2024-06-30 15:02:42 +02:00
parent 3198188376
commit a8941c964d
6 changed files with 419 additions and 10 deletions

3
.gitignore vendored
View file

@ -5,4 +5,5 @@ compile_commands.json
platform.xml
scenarios
inputs.json
results/logs
logs
analysis/scheduler/*.csv

View file

@ -6,12 +6,12 @@
- Then `make`from the project root folder
- If the project compiles successfully, you are ready to run simulations!
### Paper's Simulations
- To run all the simulations presented in the paper simply run `./results/paper.sh`
this will create the file `results/results.csv` containing all the results. This will also create an
`inputs.json` that you can modify at your convenience
### Simulations
- The file `inputs.json` controls the inputs to the simulator. You should only care about this file
if you want custom simulations
- To run the simulation just run `make run` This will also generate a file called `platform.xml` corresponding to the simulated platform
- To run a particular experiment, use the `run_*.sh` scripts
- Results are available in the `results/` folder
### Notes
- The `inputs.json` file controls the inputs to the simulator.
You should only care about this file if you want custom simulations.
- To run a simulation using `inputs.json` just run `make run`
This will also generate a file called `platform.xml` corresponding to the simulated platform
- To generate a *csv* output from the simulation results you can use:
`make run 2>&1|./parser.awk`

136
run_strategy_combined.sh Executable file
View file

@ -0,0 +1,136 @@
#!/usr/bin/env bash
set -e
wai=$(dirname $(readlink -f "$0"))
scenarios="${wai}/scenarios"
inputs="${wai}/inputs.json"
simulator="make run"
sched="${wai}/analysis/scheduler/analysis.sh"
parser="${wai}/parser.awk"
results="${wai}/results/strategy_combined.csv" # UPDATE HERE TO CHANGE OUTPUT CSV FILE NAME
aheaders="simkey,wireless,wakeupfor"
avalues="none,none,none"
log_file="${wai}/logs/$(date +%s).org" && mkdir -p "${wai}/logs/"
gen_log=0 # Should we generate logs ?
run-simulation () {
# Generate inputs
$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"
# 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}"
# 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
rm $tmp
}
# Default Parameters
seed=0
simtime=86400 # One day
wakeupevery=3600
wakeupfor=60
n_nodes=13 # First node will be the sender so n_receivers=n_nodes-1
extended="false"
hint="false"
poff=0
pon=0.4
prx=0.16
ptx=0.16
datasize=1000000 # 1Mb
hintsize=8 # Integer
hintdist=10800 # Hint distance while using farhint
latency=0 # in Seconds
shutdown_on_rcv="true"
unschedule_on_rcv="true"
farhint="true"
bitrate="100kbps"
run-scenarios() {
# Configure number of seed per scenarios
nseed=200
# Baseline
avalues="baseline,$wireless,$wakeupfor"
for seed in $(seq 1 $nseed)
do
printf "\rBaseline...${seed}"
run-simulation
done
echo
# Hint
hint="true"
avalues="hint,$wireless,$wakeupfor"
for seed in $(seq 1 $nseed)
do
printf "\rHint...${seed}"
run-simulation
done
hint="false"
echo
# Extended
extended="true"
avalues="extended,$wireless,$wakeupfor"
for seed in $(seq 1 $nseed)
do
printf "\rExtended...${seed}"
run-simulation
done
extended="false"
echo
# Hint+Extended
extended="true"
hint="true"
avalues="hintandextended,$wireless,$wakeupfor"
for seed in $(seq 1 $nseed)
do
printf "\rHint + Extended...${seed}"
run-simulation
done
extended="false"
hint="false"
echo
}
# Clean previous runs
[ -e "${results}" ] && rm "${results}"
for wakeupfor in 60 180
do
# Lora
echo "----- Run Lora (wakeupfor=$wakeupfor) -----"
wireless="lora"
bitrate="50kbps"
pon=0.4
prx=0.16
ptx=0.16
latency=0
run-scenarios
# NbIot
echo "----- Run NbIoT (wakeupfor=$wakeupfor) -----"
wireless="nbiot"
bitrate="200kbps"
pon=0.4
prx=0.65
ptx=0.65
latency=0
run-scenarios
done

View file

@ -8,7 +8,7 @@ inputs="${wai}/inputs.json"
simulator="make run"
sched="${wai}/analysis/scheduler/analysis.sh"
parser="${wai}/parser.awk"
results="${wai}/test.csv" # UPDATE HERE TO CHANGE OUTPUT CSV FILE NAME
results="${wai}/results/strategy_farhint.csv" # UPDATE HERE TO CHANGE OUTPUT CSV FILE NAME
aheaders="simkey,wireless,wakeupfor"
avalues="none,none,none"
log_file="${wai}/logs/$(date +%s).org" && mkdir -p "${wai}/logs/"
@ -55,7 +55,7 @@ hintdist=10800 # Hint distance while using farhint
latency=0 # in Seconds
shutdown_on_rcv="false"
unschedule_on_rcv="false"
farhint="false"
farhint="true"
bitrate="100kbps"

136
run_strategy_sor.sh Executable file
View file

@ -0,0 +1,136 @@
#!/usr/bin/env bash
set -e
wai=$(dirname $(readlink -f "$0"))
scenarios="${wai}/scenarios"
inputs="${wai}/inputs.json"
simulator="make run"
sched="${wai}/analysis/scheduler/analysis.sh"
parser="${wai}/parser.awk"
results="${wai}/results/strategy_sor.csv" # UPDATE HERE TO CHANGE OUTPUT CSV FILE NAME
aheaders="simkey,wireless,wakeupfor"
avalues="none,none,none"
log_file="${wai}/logs/$(date +%s).org" && mkdir -p "${wai}/logs/"
gen_log=0 # Should we generate logs ?
run-simulation () {
# Generate inputs
$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"
# 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}"
# 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
rm $tmp
}
# Default Parameters
seed=0
simtime=86400 # One day
wakeupevery=3600
wakeupfor=60
n_nodes=13 # First node will be the sender so n_receivers=n_nodes-1
extended="false"
hint="false"
poff=0
pon=0.4
prx=0.16
ptx=0.16
datasize=1000000 # 1Mb
hintsize=8 # Integer
hintdist=10800 # Hint distance while using farhint
latency=0 # in Seconds
shutdown_on_rcv="true"
unschedule_on_rcv="false"
farhint="false"
bitrate="100kbps"
run-scenarios() {
# Configure number of seed per scenarios
nseed=200
# Baseline
avalues="baseline,$wireless,$wakeupfor"
for seed in $(seq 1 $nseed)
do
printf "\rBaseline...${seed}"
run-simulation
done
echo
# Hint
hint="true"
avalues="hint,$wireless,$wakeupfor"
for seed in $(seq 1 $nseed)
do
printf "\rHint...${seed}"
run-simulation
done
hint="false"
echo
# Extended
extended="true"
avalues="extended,$wireless,$wakeupfor"
for seed in $(seq 1 $nseed)
do
printf "\rExtended...${seed}"
run-simulation
done
extended="false"
echo
# Hint+Extended
extended="true"
hint="true"
avalues="hintandextended,$wireless,$wakeupfor"
for seed in $(seq 1 $nseed)
do
printf "\rHint + Extended...${seed}"
run-simulation
done
extended="false"
hint="false"
echo
}
# Clean previous runs
[ -e "${results}" ] && rm "${results}"
for wakeupfor in 60 180
do
# Lora
echo "----- Run Lora (wakeupfor=$wakeupfor) -----"
wireless="lora"
bitrate="50kbps"
pon=0.4
prx=0.16
ptx=0.16
latency=0
run-scenarios
# NbIot
echo "----- Run NbIoT (wakeupfor=$wakeupfor) -----"
wireless="nbiot"
bitrate="200kbps"
pon=0.4
prx=0.65
ptx=0.65
latency=0
run-scenarios
done

136
run_strategy_uor.sh Executable file
View file

@ -0,0 +1,136 @@
#!/usr/bin/env bash
set -e
wai=$(dirname $(readlink -f "$0"))
scenarios="${wai}/scenarios"
inputs="${wai}/inputs.json"
simulator="make run"
sched="${wai}/analysis/scheduler/analysis.sh"
parser="${wai}/parser.awk"
results="${wai}/results/strategy_uor.csv" # UPDATE HERE TO CHANGE OUTPUT CSV FILE NAME
aheaders="simkey,wireless,wakeupfor"
avalues="none,none,none"
log_file="${wai}/logs/$(date +%s).org" && mkdir -p "${wai}/logs/"
gen_log=0 # Should we generate logs ?
run-simulation () {
# Generate inputs
$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"
# 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}"
# 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
rm $tmp
}
# Default Parameters
seed=0
simtime=86400 # One day
wakeupevery=3600
wakeupfor=60
n_nodes=13 # First node will be the sender so n_receivers=n_nodes-1
extended="false"
hint="false"
poff=0
pon=0.4
prx=0.16
ptx=0.16
datasize=1000000 # 1Mb
hintsize=8 # Integer
hintdist=10800 # Hint distance while using farhint
latency=0 # in Seconds
shutdown_on_rcv="false"
unschedule_on_rcv="true"
farhint="false"
bitrate="100kbps"
run-scenarios() {
# Configure number of seed per scenarios
nseed=200
# Baseline
avalues="baseline,$wireless,$wakeupfor"
for seed in $(seq 1 $nseed)
do
printf "\rBaseline...${seed}"
run-simulation
done
echo
# Hint
hint="true"
avalues="hint,$wireless,$wakeupfor"
for seed in $(seq 1 $nseed)
do
printf "\rHint...${seed}"
run-simulation
done
hint="false"
echo
# Extended
extended="true"
avalues="extended,$wireless,$wakeupfor"
for seed in $(seq 1 $nseed)
do
printf "\rExtended...${seed}"
run-simulation
done
extended="false"
echo
# Hint+Extended
extended="true"
hint="true"
avalues="hintandextended,$wireless,$wakeupfor"
for seed in $(seq 1 $nseed)
do
printf "\rHint + Extended...${seed}"
run-simulation
done
extended="false"
hint="false"
echo
}
# Clean previous runs
[ -e "${results}" ] && rm "${results}"
for wakeupfor in 60 180
do
# Lora
echo "----- Run Lora (wakeupfor=$wakeupfor) -----"
wireless="lora"
bitrate="50kbps"
pon=0.4
prx=0.16
ptx=0.16
latency=0
run-scenarios
# NbIot
echo "----- Run NbIoT (wakeupfor=$wakeupfor) -----"
wireless="nbiot"
bitrate="200kbps"
pon=0.4
prx=0.65
ptx=0.65
latency=0
run-scenarios
done