Improve data analysis

This commit is contained in:
Loic Guegan 2021-05-10 16:03:46 +02:00
parent 44147f8896
commit 9c9be6752d
10 changed files with 19315 additions and 19212 deletions

1
.gitignore vendored
View file

@ -5,3 +5,4 @@ compile_commands.json
platform.xml
scenarios
inputs.json
results/logs

View file

@ -3,9 +3,18 @@ library("knitr")
data=read_csv("results.csv")
final=data%>%group_by(simkey,wireless,wakeupfor)%>%summarize(wireless=first(wireless),sd=sd(energy),wakeupfor=first(wakeupfor),energy=mean(energy))
finalEnergy=data%>%group_by(simkey,wireless,wakeupfor)%>%summarize(wireless=first(wireless),sd=sd(energy),wakeupfor=first(wakeupfor),energy=mean(energy))
finalStats=data%>%group_by(simkey,wireless,wakeupfor,seed)%>%
summarise(success=sum(nSend),totalUptime=mean(totalUptime))%>%
ungroup()%>%group_by(simkey,wireless,wakeupfor)%>%
summarise(sd=sd(success),success=mean(success),totalUptime=first(totalUptime))
ggplot(final,aes(x=simkey,y=energy,fill=wireless))+
# Add nSendFail to stats
sendFail=data%>%filter(node=="on0")%>%group_by(simkey,wireless,wakeupfor)%>%summarise(nSendFail=mean(nSendFail))
finalStats=finalStats%>%left_join(sendFail,by=c("simkey","wireless","wakeupfor"))
# Generate plots
ggplot(finalEnergy,aes(x=simkey,y=energy,fill=wireless))+
geom_bar(stat="identity",position=position_dodge())+
xlab("Scenarios")+ylab("Energy (J)")+
geom_errorbar(position=position_dodge(0.9),aes(ymin=energy-sd, ymax=energy+sd),width=0.5,size=1.5,) +
@ -13,15 +22,34 @@ ggplot(final,aes(x=simkey,y=energy,fill=wireless))+
geom_text(aes(label = round(energy+sd), y= energy+sd),vjust=-0.4,position=position_dodge(0.9))+
geom_text(aes(label = round(energy-sd), y= energy-sd),vjust=+1.5,position=position_dodge(0.9))+
geom_text(aes(label = round(energy), y= energy/2),fontface="bold",colour="white",position=position_dodge(0.9))
ggsave("energy.png")
ggsave("figure.png")
tf="tables.org"
ggplot(finalStats,aes(x=simkey,y=success,fill=wireless))+
geom_bar(stat="identity",position=position_dodge())+
xlab("Scenarios")+ylab("Energy (J)")+
geom_errorbar(position=position_dodge(0.9),aes(ymin=success-sd, ymax=success+sd),width=0.5,size=1.5,) +
geom_text(aes(label = round(success+sd,digits=1), y= success+sd),vjust=-0.4,position=position_dodge(0.9))+
geom_text(aes(label = round(success-sd,digits=1), y= success-sd),vjust=+1.5,position=position_dodge(0.9))+
geom_text(aes(label = round(success,digits=1), y= success/2),fontface="bold",colour="white",position=position_dodge(0.9))+
facet_wrap(~ wakeupfor) +
ggsave("success.png")
tf="tables-energy.org"
write("",file=tf)
for(wake in unique(data$wakeupfor)){
write(kable(final%>%filter(wireless=="lora",wakeupfor==wake)),file=tf,append=TRUE)
write(kable(finalEnergy%>%filter(wireless=="lora",wakeupfor==wake)),file=tf,append=TRUE)
write("\n",file=tf,append=TRUE)
write(kable(final%>%filter(wireless=="nbiot",wakeupfor==wake)),file=tf,append=TRUE)
write(kable(finalEnergy%>%filter(wireless=="nbiot",wakeupfor==wake)),file=tf,append=TRUE)
write("\n",file=tf,append=TRUE)
}
tf="tables-stats.org"
write("",file=tf)
for(wake in unique(data$wakeupfor)){
write(kable(finalStats%>%filter(wireless=="lora",wakeupfor==wake)),file=tf,append=TRUE)
write("\n",file=tf,append=TRUE)
write(kable(finalStats%>%filter(wireless=="nbiot",wakeupfor==wake)),file=tf,append=TRUE)
write("\n",file=tf,append=TRUE)
}

BIN
results/energy.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 196 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 210 KiB

View file

@ -10,16 +10,21 @@ parser="${wai}/../parser.awk"
results="${wai}/results.csv"
aheaders="simkey,wireless,wakeupfor"
avalues="none,none,none"
log_file="${wai}/logs/$(date +%s).org" && mkdir -p "${wai}/logs/"
run-simulation () {
# Generate inputs
$scenarios $seed $simtime $wakeupevery $wakeupfor $n_nodes $extended $hint $poff $pon $prx $ptx $datasize $bitrate > "$inputs"
# 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}"
# Run simulations
if [ -e "$results" ]
then
$simulator 2>&1 | $parser | sed 1d | sed "s/$/,${avalues}/" >> "$results"
$simulator 2>&1 | tee -a "${log_file}" | $parser | sed 1d | sed "s/$/,${avalues}/" >> "$results"
else
$simulator 2>&1 | $parser | sed "1 s/$/,${aheaders}/g" | sed "2,\$s/$/,${avalues}/" > "$results"
$simulator 2>&1 | tee -a "${log_file}" | $parser | sed "1 s/$/,${aheaders}/g" | sed "2,\$s/$/,${avalues}/" > "$results"
fi
}
@ -90,7 +95,7 @@ for wakeupfor in 60 180
do
# Lora
echo "----- Run Lora ($wakeupfor) -----"
echo "----- Run Lora (wakeupfor=$wakeupfor) -----"
wireless="lora"
bitrate="50kbps"
pon=0.4
@ -99,7 +104,7 @@ do
run-scenarios
# NbIot
echo "----- Run NbIoT ($wakeupfor) -----"
echo "----- Run NbIoT (wakeupfor=$wakeupfor) -----"
wireless="nbiot"
bitrate="200kbps"
pon=0.4

File diff suppressed because it is too large Load diff

BIN
results/success.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 122 KiB

33
results/tables-energy.org Normal file
View file

@ -0,0 +1,33 @@
|simkey |wireless | wakeupfor| sd| energy|
|:---------------|:--------|---------:|----------:|--------:|
|baseline |lora | 60| 0.2266042| 230.3920|
|extended |lora | 60| 50.7186446| 606.5560|
|hint |lora | 60| 0.2266042| 230.3920|
|hintandextended |lora | 60| 52.7539403| 617.1553|
|simkey |wireless | wakeupfor| sd| energy|
|:---------------|:--------|---------:|----------:|--------:|
|baseline |nbiot | 60| 0.9205795| 935.9675|
|extended |nbiot | 60| 51.9906616| 607.3420|
|hint |nbiot | 60| 0.9205795| 935.9675|
|hintandextended |nbiot | 60| 53.9800436| 617.9613|
|simkey |wireless | wakeupfor| sd| energy|
|:---------------|:--------|---------:|---------:|---------:|
|baseline |lora | 180| 2.276321| 690.8349|
|extended |lora | 180| 34.623157| 1723.1557|
|hint |lora | 180| 2.276321| 690.8349|
|hintandextended |lora | 180| 51.402788| 1776.4173|
|simkey |wireless | wakeupfor| sd| energy|
|:---------------|:--------|---------:|---------:|--------:|
|baseline |nbiot | 180| 387.22964| 2401.296|
|extended |nbiot | 180| 89.44436| 1774.901|
|hint |nbiot | 180| 360.14353| 2443.371|
|hintandextended |nbiot | 180| 78.21175| 1831.326|

33
results/tables-stats.org Normal file
View file

@ -0,0 +1,33 @@
|simkey |wireless | wakeupfor| sd| success| totalUptime| nSendFail|
|:---------------|:--------|---------:|--------:|-------:|-----------:|---------:|
|baseline |lora | 60| 0.000000| 0.00| 1440.000| 28.41|
|extended |lora | 60| 1.598105| 5.54| 1717.583| 18.46|
|hint |lora | 60| 0.000000| 0.00| 1440.000| 28.41|
|hintandextended |lora | 60| 1.598105| 5.54| 1747.583| 18.46|
|simkey |wireless | wakeupfor| sd| success| totalUptime| nSendFail|
|:---------------|:--------|---------:|--------:|-------:|-----------:|---------:|
|baseline |nbiot | 60| 0.000000| 0.00| 1440.000| 28.41|
|extended |nbiot | 60| 1.591486| 5.55| 1477.583| 18.45|
|hint |nbiot | 60| 0.000000| 0.00| 1440.000| 28.41|
|hintandextended |nbiot | 60| 1.591486| 5.55| 1507.583| 18.45|
|simkey |wireless | wakeupfor| sd| success| totalUptime| nSendFail|
|:---------------|:--------|---------:|-------:|-------:|-----------:|---------:|
|baseline |lora | 180| 0.00000| 0.00| 4320.000| 37.05|
|extended |lora | 180| 1.25352| 9.38| 4622.083| 14.03|
|hint |lora | 180| 0.00000| 0.00| 4320.000| 37.05|
|hintandextended |lora | 180| 1.25352| 9.38| 4772.083| 14.03|
|simkey |wireless | wakeupfor| sd| success| totalUptime| nSendFail|
|:---------------|:--------|---------:|--------:|-------:|-----------:|---------:|
|baseline |nbiot | 180| 1.616956| 7.54| 4320.000| 27.93|
|extended |nbiot | 180| 1.157147| 9.88| 4334.750| 19.33|
|hint |nbiot | 180| 1.616956| 7.54| 4440.000| 27.93|
|hintandextended |nbiot | 180| 1.157147| 9.88| 4474.167| 19.33|

View file

@ -93,6 +93,7 @@ static void obs_node(std::vector<std::string> args) {
u32 nSendFail=0;
u32 nRcvFail=0;
u32 nSend=0;
double totalUptime=0;
while(i.ShouldContinue()){
XBT_INFO("%s is spleeping",selfName.c_str());
MODE_OFF();
@ -102,6 +103,7 @@ static void obs_node(std::vector<std::string> args) {
// Doing wake up stuff
double uptime=i.GetDuration();
double startUptime=simgrid::s4u::Engine::get_clock();
while(uptime>0.00001){ // Ensure not infinite loop even if it should not happend (we loose accuracy here but just in case)
try {
if(isSender){ // If I am a sender
@ -180,8 +182,9 @@ static void obs_node(std::vector<std::string> args) {
// Load next event
i.GotoNextEvent();
nWakeUp++; // Increase the number of wake up
totalUptime+=simgrid::s4u::Engine::get_clock()-startUptime;
}
// Done
MODE_OFF()
XBT_INFO("Observation node %s finished [LOG2PARSE](node:%s|nSend:%d|nWakeUp:%d|nDataRcv:%d|nSendFail:%d|nRcvFail:%d|seed:%d)",selfName.c_str(),selfName.c_str(),nSend,nWakeUp,nDataRcv,nSendFail,nRcvFail,i.seed);
XBT_INFO("Observation node %s finished [LOG2PARSE](node:%s|nSend:%d|nWakeUp:%d|nDataRcv:%d|nSendFail:%d|nRcvFail:%d|totalUptime:%f|seed:%d)",selfName.c_str(),selfName.c_str(),nSend,nWakeUp,nDataRcv,nSendFail,nRcvFail,totalUptime,i.seed);
}