mirror of
https://gitlab.com/manzerbredes/loosely-coupled-dss-extended.git
synced 2025-04-05 19:16:26 +02:00
Update scalability analysis
This commit is contained in:
parent
45ff3848e5
commit
41d0a70829
8 changed files with 1915245 additions and 0 deletions
320101
results.csv
Normal file
320101
results.csv
Normal file
File diff suppressed because it is too large
Load diff
BIN
results/180_scalability.png
Normal file
BIN
results/180_scalability.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 314 KiB |
BIN
results/60_scalability.png
Normal file
BIN
results/60_scalability.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 354 KiB |
112
results/analysis4_scalability.R
Normal file
112
results/analysis4_scalability.R
Normal file
|
@ -0,0 +1,112 @@
|
|||
library("tidyverse")
|
||||
library("ggthemes")
|
||||
library("gridExtra")
|
||||
library("patchwork")
|
||||
library(RColorBrewer)
|
||||
|
||||
data=read_csv("results_scalability.csv")
|
||||
r_=function(x){round(x,digits=1)}
|
||||
color=function(){scale_fill_brewer(palette = "Accent")}
|
||||
color2=function(){scale_fill_brewer(palette = "Set2")}
|
||||
nolegend=function(){theme(legend.position="none")}
|
||||
simkeys=unique(data$simkey)
|
||||
nsimkeys=length(simkeys)
|
||||
s_=function(x){if(x<0){return("")}else{return("+")}}
|
||||
simkey_rename=function(key){
|
||||
if(key=="hint")
|
||||
return("Hints")
|
||||
if(key=="baseline")
|
||||
return("Baseline")
|
||||
if(key=="extended")
|
||||
return("Extended")
|
||||
if(key=="hintandextended")
|
||||
return("Hints+Extended")
|
||||
return(key)
|
||||
}
|
||||
dformat=function(data){
|
||||
data%>%rowwise()%>%mutate(simkey=simkey_rename(simkey))%>%mutate(wireless=ifelse(wireless=="lora","LoRa","Nb-IoT"))
|
||||
}
|
||||
g_legend <- function(a.gplot){
|
||||
tmp <- ggplot_gtable(ggplot_build(a.gplot))
|
||||
leg <- which(sapply(tmp$grobs, function(x) x$name) == "guide-box")
|
||||
legend <- tmp$grobs[[leg]]
|
||||
legend
|
||||
}
|
||||
|
||||
custom_theme=function(){theme_clean()+ theme(plot.background=element_blank())}
|
||||
|
||||
data=data%>%dformat()
|
||||
|
||||
# Compute delivery success
|
||||
statsSuccess=data%>%filter(isSender!=0)%>%group_by(wireless,wakeupfor,n_nodes,seed,simkey)%>%summarize(success=mean(nSend))%>%ungroup()
|
||||
data=data%>%left_join(statsSuccess,by=c("wireless","wakeupfor","n_nodes","seed","simkey"))
|
||||
|
||||
# Computer stats senders
|
||||
statsSender=data%>%filter(isSender!=0)%>%group_by(wireless,wakeupfor,n_nodes,seed,simkey)%>%summarize(success=mean(success),energy=mean(energy))%>%ungroup()
|
||||
statsSender=statsSender%>%group_by(wireless,wakeupfor,n_nodes,simkey)%>%summarize(success_sd=sd(success),success=mean(success),energy_sd=sd(energy),energy=mean(energy))%>%ungroup()
|
||||
|
||||
# Computer stats receiver
|
||||
statsReceiver=data%>%filter(isSender==0)%>%group_by(wireless,wakeupfor,n_nodes,seed,simkey)%>%summarize(success=mean(success),energy=mean(energy))%>%ungroup()
|
||||
statsReceiver=statsReceiver%>%group_by(wireless,wakeupfor,n_nodes,simkey)%>%summarize(success_sd=sd(success),success=mean(success),energy_sd=sd(energy),energy=mean(energy))%>%ungroup()
|
||||
|
||||
|
||||
# Energy
|
||||
sender60sPlotEnergy=ggplot(statsSender%>%filter(wakeupfor==60),aes(n_nodes,energy,color=simkey,group=simkey))+
|
||||
geom_ribbon(aes(ymin=energy-energy_sd, ymax=energy+energy_sd,fill=simkey),linetype=1,alpha=0.4)+
|
||||
geom_point()+geom_line()+
|
||||
facet_wrap(~wireless)+xlab("Number of node")+ylab("Energy consumption (J)")+labs(colour="Policy")+custom_theme()+theme(legend.position="top")+ggtitle("Sender")+
|
||||
guides(colour=FALSE,fill=guide_legend(title="Policy"))
|
||||
|
||||
sender180sPlotEnergy=ggplot(statsSender%>%filter(wakeupfor==180),aes(n_nodes,energy,color=simkey,group=simkey))+
|
||||
geom_ribbon(aes(ymin=energy-energy_sd, ymax=energy+energy_sd,fill=simkey),linetype=1,alpha=0.4)+
|
||||
geom_point()+geom_line()+
|
||||
facet_wrap(~wireless)+xlab("Number of node")+ylab("Energy consumption (J)")+labs(colour="Policy")+custom_theme()+theme(legend.position="top")+ggtitle("Sender")+
|
||||
guides(colour=FALSE,fill=guide_legend(title="Policy"))
|
||||
|
||||
|
||||
receiver60sPlotEnergy=ggplot(statsReceiver%>%filter(wakeupfor==60),aes(n_nodes,energy,color=simkey,group=simkey))+
|
||||
geom_ribbon(aes(ymin=energy-energy_sd, ymax=energy+energy_sd,,fill=simkey),linetype=1,alpha=0.4)+
|
||||
geom_point()+geom_line()+
|
||||
facet_wrap(~wireless)+xlab("Number of node")+ylab("Energy consumption (J)")+labs(colour="Policy") + custom_theme()+theme(legend.position="top")+ggtitle("Receiver")+
|
||||
guides(colour=FALSE,fill=guide_legend(title="Policy"))
|
||||
|
||||
receiver180sPlotEnergy=ggplot(statsReceiver%>%filter(wakeupfor==180),aes(n_nodes,energy,color=simkey,group=simkey))+
|
||||
geom_ribbon(aes(ymin=energy-energy_sd, ymax=energy+energy_sd,fill=simkey),linetype=1,alpha=0.4)+
|
||||
geom_point()+geom_line()+
|
||||
facet_wrap(~wireless)+xlab("Number of node")+ylab("Energy consumption (J)")+labs(colour="Policy")+custom_theme()+theme(legend.position="top")+ggtitle("Receiver")+
|
||||
guides(colour=FALSE,fill=guide_legend(title="Policy"))
|
||||
|
||||
# Success
|
||||
sender60sPlotSuccess=ggplot(statsSender%>%filter(wakeupfor==60),aes(n_nodes,success,color=simkey,group=simkey))+
|
||||
geom_ribbon(aes(ymin=success-success_sd, ymax=success+success_sd,fill=simkey),linetype=1,alpha=0.4)+
|
||||
geom_point()+geom_line()+
|
||||
facet_wrap(~wireless)+xlab("Number of node")+ylab("Number of delivery success")+labs(colour="Policy")+custom_theme()+theme(legend.position="top")+
|
||||
theme(panel.background = element_rect(fill = '#EFEFEF', color=NA))+guides(colour=FALSE,fill=guide_legend(title="Policy"))
|
||||
|
||||
sender180sPlotSuccess=ggplot(statsSender%>%filter(wakeupfor==180),aes(n_nodes,success,color=simkey,group=simkey))+
|
||||
geom_ribbon(aes(ymin=success-success_sd, ymax=success+success_sd,fill=simkey),linetype=1,alpha=0.4)+
|
||||
geom_point()+geom_line()+
|
||||
facet_wrap(~wireless)+xlab("Number of node")+ylab("Number of delivery success")+labs(colour="Policy")+custom_theme()+theme(legend.position="top")+
|
||||
theme(panel.background = element_rect(fill = '#EFEFEF', color=NA))+guides(colour=FALSE,fill=guide_legend(title="Policy"))
|
||||
|
||||
|
||||
receiver60sPlotSuccess=ggplot(statsReceiver%>%filter(wakeupfor==60),aes(n_nodes,success,color=simkey,group=simkey))+
|
||||
geom_ribbon(aes(ymin=success-success_sd, ymax=success+success_sd,fill=simkey),linetype=1,alpha=0.4)+
|
||||
geom_point()+geom_line()+
|
||||
facet_wrap(~wireless)+xlab("Number of node")+ylab("Number of delivery success")+labs(colour="Policy") + custom_theme()+theme(legend.position="top")+
|
||||
theme(panel.background = element_rect(fill = '#EFEFEF', color=NA))+guides(colour=FALSE,fill=guide_legend(title="Policy"))
|
||||
|
||||
receiver180sPlotSuccess=ggplot(statsReceiver%>%filter(wakeupfor==180),aes(n_nodes,success,color=simkey,group=simkey))+
|
||||
geom_ribbon(aes(ymin=success-success_sd, ymax=success+success_sd,fill=simkey),linetype=1,alpha=0.4)+
|
||||
geom_point()+geom_line()+
|
||||
facet_wrap(~wireless)+xlab("Number of node")+ylab("Number of delivery success")+labs(colour="Policy")+custom_theme()+theme(legend.position="top")+
|
||||
theme(panel.background = element_rect(fill = '#EFEFEF', color=NA))+guides(colour=FALSE,fill=guide_legend(title="Policy"))
|
||||
|
||||
|
||||
|
||||
w=15
|
||||
h=9
|
||||
space=2
|
||||
ggsave("scalability_60s.pdf",plot=(sender60sPlotEnergy+theme(plot.margin=unit(c(0.1,space,0,0),"cm"))+receiver60sPlotEnergy)/sender60sPlotSuccess+plot_layout(guides = 'collect')&theme(legend.position="bottom"),width=w,height=h)
|
||||
ggsave("scalability_180s.pdf",plot=(sender180sPlotEnergy+theme(plot.margin=unit(c(0.1,space,0,0),"cm"))+receiver180sPlotEnergy)/sender180sPlotSuccess+plot_layout(guides = 'collect')&theme(legend.position="bottom"),width=w,height=h)
|
||||
|
139
results/paper_scalability.sh
Executable file
139
results/paper_scalability.sh
Executable file
|
@ -0,0 +1,139 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
|
||||
wai=$(dirname $(readlink -f "$0"))
|
||||
scenarios="${wai}/../scenarios"
|
||||
inputs="${wai}/../inputs.json"
|
||||
simulator="make -C ${wai}/../ run"
|
||||
sched="${wai}/scheduler/analysis.sh"
|
||||
parser="${wai}/../parser.awk"
|
||||
results="${wai}/results_scalability.csv"
|
||||
aheaders="simkey,wireless,wakeupfor,n_nodes"
|
||||
avalues="none,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="false"
|
||||
farhint="false"
|
||||
bitrate="100kbps"
|
||||
|
||||
|
||||
run-scenarios() {
|
||||
# Configure number of seed per scenarios
|
||||
nseed=5
|
||||
|
||||
# Baseline
|
||||
avalues="baseline,$wireless,$wakeupfor,$n_nodes"
|
||||
for seed in $(seq 1 $nseed)
|
||||
do
|
||||
printf "\rBaseline...${seed}"
|
||||
run-simulation
|
||||
done
|
||||
echo
|
||||
|
||||
# Hint
|
||||
hint="true"
|
||||
avalues="hint,$wireless,$wakeupfor,$n_nodes"
|
||||
for seed in $(seq 1 $nseed)
|
||||
do
|
||||
printf "\rHint...${seed}"
|
||||
run-simulation
|
||||
done
|
||||
hint="false"
|
||||
echo
|
||||
|
||||
# Extended
|
||||
extended="true"
|
||||
avalues="extended,$wireless,$wakeupfor,$n_nodes"
|
||||
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,$n_nodes"
|
||||
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
|
||||
|
||||
for n_nodes in $(shuf -i 12-100 -n 30|sort)
|
||||
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
|
||||
done
|
1594893
results/results_scalability.csv
Normal file
1594893
results/results_scalability.csv
Normal file
File diff suppressed because it is too large
Load diff
BIN
results/scalability_180s.pdf
Normal file
BIN
results/scalability_180s.pdf
Normal file
Binary file not shown.
BIN
results/scalability_60s.pdf
Normal file
BIN
results/scalability_60s.pdf
Normal file
Binary file not shown.
Loading…
Add table
Reference in a new issue