summaryrefslogtreecommitdiff
path: root/ns3-simulations/simulate.org
diff options
context:
space:
mode:
authorLoic Guegan <manzerberdes@gmx.com>2019-04-29 09:00:49 +0200
committerLoic Guegan <manzerberdes@gmx.com>2019-04-29 09:00:49 +0200
commitbf9646552888e022c22139448c33c1b219b9e713 (patch)
tree4ca6121e3513e5438392309d636683ec67adb923 /ns3-simulations/simulate.org
parentdaa845cc4974763437d925afefda082bf69bb597 (diff)
Update simulations
Diffstat (limited to 'ns3-simulations/simulate.org')
-rw-r--r--ns3-simulations/simulate.org46
1 files changed, 32 insertions, 14 deletions
diff --git a/ns3-simulations/simulate.org b/ns3-simulations/simulate.org
index b47c5ae..43aa253 100644
--- a/ns3-simulations/simulate.org
+++ b/ns3-simulations/simulate.org
@@ -14,11 +14,13 @@
#+BEGIN_SRC bash :noweb yes :results output
<<singleRun>>
simKey="BW"
- sensorsNumber=10
- for linksBandwidth in $(seq 10 20 100)
+ for sensorsNumber in $(seq 1 15)
do
- run
- done
+ for linksBandwidth in $(seq 10 20 100)
+ do
+ run
+ done
+ done
#+END_SRC
#+RESULTS: runBW
@@ -30,11 +32,13 @@
#+BEGIN_SRC bash :noweb yes :results output
<<singleRun>>
simKey="LATENCY"
- sensorsNumber=10
- for linksLatency in $(seq 1 1 10)
+ for sensorsNumber in $(seq 1 15)
do
- run
- done
+ for linksLatency in $(seq 1 1 10)
+ do
+ run
+ done
+ done
#+END_SRC
#+RESULTS: runLat
@@ -59,12 +63,17 @@
#+BEGIN_SRC bash :noweb yes :results output
<<singleRun>>
simKey="NBHOP"
- for nbHop in $(seq 1 10)
+ for sensorsNumber in $(seq 1 15)
do
- run
- done
+ for nbHop in $(seq 1 10)
+ do
+ run
+ done
+ done
#+END_SRC
+ #+RESULTS: runNbHop
+
** Single Run
#+NAME: singleRun
@@ -144,12 +153,14 @@
#+NAME: genAllPlots
#+BEGIN_SRC R :noweb yes :results output
<<RUtils>>
- easyPlot("linksLatency","totalEnergy", "LATENCY")
- easyPlot("linksBandwidth","totalEnergy", "BW")
+ easyPlotGroup("linksLatency","totalEnergy", "LATENCY","sensorsNumber")
+ easyPlotGroup("linksBandwidth","totalEnergy", "BW","sensorsNumber")
easyPlot("sensorsNumber","totalEnergy", "NBSENSORS")
- easyPlot("nbHop","totalEnergy", "NBHOP")
+ easyPlotGroup("nbHop","totalEnergy", "NBHOP","sensorsNumber")
#+END_SRC
+ #+RESULTS: genAllPlots
+
*** R Utils
RUtils is intended to load logs (data.csv) and providing
simple plot function for them.
@@ -180,6 +191,13 @@
ggplot(curData,aes_string(x=X,y=Y))+geom_point()+geom_line()+xlab(getLabel(X))+ylab(getLabel(Y))
ggsave(paste0("plots/",KEY,"-",X,"_",Y,".png"))
}
+
+ easyPlotGroup=function(X,Y,KEY,GRP){
+ curData=data%>%filter(simKey==KEY) %>% mutate(!!GRP:=as.character(UQ(rlang::sym(GRP)))) # %>%mutate(sensorsNumber=as.character(sensorsNumber))
+ stopifnot(NROW(curData)>0)
+ ggplot(curData,aes_string(x=X,y=Y,color=GRP,group=GRP))+geom_point()+geom_line()+xlab(getLabel(X))+ylab(getLabel(Y)) + labs(color = getLabel(GRP))
+ ggsave(paste0("plots/",KEY,"-",X,"_",Y,".png"))
+ }
#+END_SRC
** Plots -> PDF