summaryrefslogtreecommitdiff
path: root/ns3-simulations/simulate.org
diff options
context:
space:
mode:
Diffstat (limited to 'ns3-simulations/simulate.org')
-rw-r--r--ns3-simulations/simulate.org21
1 files changed, 18 insertions, 3 deletions
diff --git a/ns3-simulations/simulate.org b/ns3-simulations/simulate.org
index 87730ec..1f3a2af 100644
--- a/ns3-simulations/simulate.org
+++ b/ns3-simulations/simulate.org
@@ -84,10 +84,25 @@
#+END_SRC
** R Scripts
*** Load Data
- #+BEGIN_SRC R
- print("lkj")
+ #+NAME: loadData
+ #+BEGIN_SRC R :var genLog=logToCSV()
+ library("tidyverse")
+
+
+ getLabel=function(varName){
+ labels=c(nbNodes="Node Number",nbSensors="Sensor Number",totalEnergy="Total Energy (J)")
+ if(is.na(labels[varName])){
+ return(varName)
+ }
+ return(labels[varName])
+ }
+
+ # Load Data
+ data=read_csv("logs/data.csv")
+ ggplot(data,aes(x=nbNodes,y=totalEnergy))+geom_point()+geom_line()+xlab(getLabel("nbNodes"))+ylab(getLabel("totalEnergy"))
+ ggsave("plot.png")
#+END_SRC
-
+