summaryrefslogtreecommitdiff
path: root/analysis/analysis.R
diff options
context:
space:
mode:
Diffstat (limited to 'analysis/analysis.R')
-rw-r--r--analysis/analysis.R32
1 files changed, 13 insertions, 19 deletions
diff --git a/analysis/analysis.R b/analysis/analysis.R
index 8a76849..bd27626 100644
--- a/analysis/analysis.R
+++ b/analysis/analysis.R
@@ -1,4 +1,5 @@
library("tidyverse")
+library("viridis")
## Simulation Parameters:
## simkey {baseline,extended,hint,hintandextended}
@@ -19,7 +20,7 @@ nwireless=2
nsimkey=4
nsimulations=nseed*nwakeupfor*nwireless*nsimkey # Must be 3200
-if(1==2){
+if(FALSE){ # Toggle
## Load data
data=read_csv("../CCGRID2022.csv")%>%distinct() # Note that in the data experiment wireless=="lora",seed==1,wakeupfor==60,simkey=="baseline" is present 2 times in the CSV file
tmp_data_coverage=data%>%group_by(simkey,wireless,wakeupfor,seed)%>%mutate(coverage=sum(nDataRcv))%>%ungroup()%>%filter(isSender==1)%>%select(simkey,wireless,wakeupfor,seed,coverage)
@@ -42,24 +43,17 @@ sim=sim%>%mutate(id_rand=rand_id[id])
}
## Perform various plots to understand the data
GG_VARIOUS=function(){
- ## Dimension Coverage
- ggplot(data_seed%>%mutate(wakeupfor=as.character(wakeupfor)),
- aes(simkey,coverage,color=wakeupfor))+geom_point()+facet_wrap(~wireless+wakeupfor)+ggtitle("Dimension Coverage")
- ggsave("figures/dimension_coverage.pdf")
- ## Dimension Energy
- ggplot(data_seed%>%mutate(wakeupfor=as.character(wakeupfor)),
- aes(simkey,energy,color=wakeupfor))+geom_point()+facet_wrap(~wireless+wakeupfor)+ggtitle("Dimension Energy")+ylab("Energy Consumption (J)")
- ggsave("figures/dimension_energy.pdf")
- ## Dimension Efficiency
- ggplot(data_seed%>%mutate(wakeupfor=as.character(wakeupfor)),
- aes(simkey,efficiency,color=wakeupfor))+
- geom_point()+facet_wrap(~wireless+wakeupfor)+ggtitle("Dimension Efficiency")+ylab("Efficiency (J/Succ)")
- ggsave("figures/dimension_efficiency.pdf")
## Dimension Energy/Coverage
ggplot(data_seed%>%mutate(wakeupfor=as.character(wakeupfor)),
- aes(coverage,energy,color=simkey))+geom_point(alpha=0.5)+labs(color="Policy")+theme(legend.position="top")+
- ggtitle("Dimension Energy/Coverage")+xlab("Coverage")+ylab("Nodes energy consumption (J)")+
- facet_wrap(~wakeupfor+wireless,scale="free")
+ aes(coverage,energy,color=simkey))+geom_point(aes(shape=simkey),alpha=0.5)+labs(color="Policy")+
+ xlab("Network coverage")+ylab("Nodes energy consumption (J)")+
+ scale_shape_manual(values=c(22, 15, 16,1))+labs(shape="Policy",color="Policy")+
+ theme_bw()+
+ guides(colour = guide_legend(override.aes = list(alpha = 1)))+
+ facet_wrap(~wakeupfor+wireless,scale="free")+scale_color_viridis(discrete=TRUE)+
+ theme(legend.position = c(0.15,0.87),
+ legend.background = element_rect(fill = "white", color = "black",size=0.8))+
+ scale_x_continuous(breaks=seq(0,12))
ggsave("figures/dimension_energy-coverage.pdf")
## Dimension Energy/Coverage Wakeupfor
ggplot(data_seed%>%mutate(wakeupfor=as.character(wakeupfor)),
@@ -114,8 +108,8 @@ GG_SIMULATIONS = function(file,key="NOKEY") {
}
-GG_SIMULATIONS("../simulations/results/results_NoHintIsFALSE.csv",key="WITH_HINT")
-GG_SIMULATIONS("../simulations/results/results_NoHintIsTRUE.csv",key="NO_HINT")
+#GG_SIMULATIONS("../simulations/results/results_NoHintIsFALSE.csv",key="WITH_HINT")
+#GG_SIMULATIONS("../simulations/results/results_NoHintIsTRUE.csv",key="NO_HINT")
system("rm -f figures/combined.pdf")
system("pdfunite figures/*.pdf figures/combined.pdf")