mirror of
https://gitlab.com/manzerbredes/paper-lowrate-iot.git
synced 2025-06-07 15:17:40 +00:00
Add new simulations
This commit is contained in:
parent
7c9410246f
commit
1875f45231
16 changed files with 248249 additions and 85375 deletions
|
@ -5,12 +5,17 @@
|
|||
* Logs Analysis
|
||||
** R Scripts
|
||||
*** Generate all plots script
|
||||
#+BEGIN_SRC R
|
||||
#<<RUtils>>
|
||||
#+BEGIN_SRC R :results graphics :file second-try/plot.png :noweb yes
|
||||
<<RUtils>>
|
||||
data=loadData("./second-try/data.csv")
|
||||
|
||||
|
||||
energy=loadEnergy
|
||||
data=data%>%filter(simKey=="nbSensors")%>%filter(nbSensors==20)
|
||||
ggplot(data,aes(x=time,y=energy))+geom_point(position="jitter")+xlab(getLabel("time"))+expand_limits(y=0)#+geom_hline(aes(group=nbSensors,color=nbSensors,yintercept=mean(energy)))
|
||||
ggsave("./second-try/plot.png",dpi=80)
|
||||
#+END_SRC
|
||||
|
||||
#+RESULTS:
|
||||
[[file:second-try/plot.png]]
|
||||
|
||||
|
||||
*** R Utils
|
||||
|
@ -22,17 +27,10 @@
|
|||
library("tidyverse")
|
||||
|
||||
# Fell free to update the following
|
||||
labels=c(nbNodes="Number of nodes",sensorsNumber="Number of sensors",totalEnergy="Total Energy (J)",
|
||||
nbHop="Number of hop (AP to Cloud)", linksBandwidth="Links Bandwidth (Mbps)", avgDelay="Average Application Delay (s)",
|
||||
linksLatency="Links Latency (ms)", sensorsSendInterval="Sensors Send Interval (s)", positionSeed="Position Seed",
|
||||
sensorsEnergy="Sensors Wifi Energy Consumption (J)", networkEnergy="Network Energy Consumption (J)")
|
||||
|
||||
# Load Data
|
||||
data=read_csv("logs/data.csv")
|
||||
|
||||
labels=c(time="Time (s)")
|
||||
|
||||
loadData=function(path){
|
||||
data=read_csv(path)
|
||||
data%>%mutate(time=ts-min(ts))
|
||||
}
|
||||
|
||||
# Get label according to varName
|
||||
|
@ -83,17 +81,15 @@
|
|||
emacs $orgFile --batch -f org-latex-export-to-pdf --kill
|
||||
#+END_SRC
|
||||
|
||||
#+RESULTS:
|
||||
|
||||
|
||||
|
||||
** CSVs -> CSV
|
||||
Merge all energy file into one (and add additional fields).
|
||||
|
||||
#+NAME: mergeCSV
|
||||
#+BEGIN_SRC sh :results output
|
||||
#+BEGIN_SRC sh
|
||||
#!/bin/bash
|
||||
|
||||
whichLog="first-try"
|
||||
whichLog="second-try"
|
||||
|
||||
|
||||
logFile="$(dirname $(readlink -f $0))"/$whichLog/simLogs.txt
|
||||
|
@ -118,13 +114,14 @@
|
|||
simKey=$(getValue $cmd simKey)
|
||||
csvFile="$whichLog/${simKey}_${vmSize}VMSIZE_${nbSensors}NBSENSORS_${from}${to}.csv"
|
||||
tmpFile=${csvFile}_tmp
|
||||
echo ts,energy,simKey,vmSize,nbSensors > $tmpFile
|
||||
tail -n+2 ${csvFile} | awk '{print $0",'$simKey','$vmSize','$nbSensors'"}' >> $tmpFile
|
||||
echo ts,energy,simKey,vmSize,nbSensors,time > $tmpFile
|
||||
minEnergy=$(tail -n+2 $csvFile|awk -F"," 'BEGIN{min=0}$1<min||min==0{min=$1}END{print(min)}') # To compute ts field
|
||||
tail -n+2 ${csvFile} | awk -F"," '{print $0",'$simKey','$vmSize','$nbSensors',"$1-'$minEnergy'}' >> $tmpFile
|
||||
done
|
||||
|
||||
|
||||
##### File dataFile #####
|
||||
echo ts,energy,simKey,vmSize,nbSensors > $dataFile
|
||||
echo ts,energy,simKey,vmSize,nbSensors,time > $dataFile
|
||||
for tmpFile in $(find ${whichLog}/*_tmp -type f)
|
||||
do
|
||||
tail -n+2 $tmpFile >> $dataFile
|
||||
|
@ -132,7 +129,9 @@
|
|||
done
|
||||
#+END_SRC
|
||||
|
||||
#+RESULTS:
|
||||
#+RESULTS: mergeCSV
|
||||
|
||||
|
||||
|
||||
** Custom Plots
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue