mirror of
https://gitlab.com/manzerbredes/paper-lowrate-iot.git
synced 2025-06-05 22:27:39 +00:00
Add simulation scripts
This commit is contained in:
parent
39507e0bb5
commit
1da73fb609
18 changed files with 4043 additions and 2 deletions
1
ns3-simulations/.#simulate.org
Symbolic link
1
ns3-simulations/.#simulate.org
Symbolic link
|
@ -0,0 +1 @@
|
||||||
|
loic@lguegan.7447:1555309869
|
1947
ns3-simulations/logs/log.txt
Normal file
1947
ns3-simulations/logs/log.txt
Normal file
File diff suppressed because it is too large
Load diff
6
ns3-simulations/logs/log.txt-energy.csv
Normal file
6
ns3-simulations/logs/log.txt-energy.csv
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
node,energy
|
||||||
|
0,1.00026
|
||||||
|
1,2.00021
|
||||||
|
2,2.00021
|
||||||
|
3,2
|
||||||
|
4,1
|
|
1
ns3-simulations/logs/log.txt-energy.csv-energy.csv
Normal file
1
ns3-simulations/logs/log.txt-energy.csv-energy.csv
Normal file
|
@ -0,0 +1 @@
|
||||||
|
node,energy
|
|
5
ns3-simulations/logs/log.txt.csv
Normal file
5
ns3-simulations/logs/log.txt.csv
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
0,1.00026
|
||||||
|
1,2.00021
|
||||||
|
2,2.00021
|
||||||
|
3,2
|
||||||
|
4,1
|
|
1
ns3-simulations/logs/log.txt.csv-energy.csv
Normal file
1
ns3-simulations/logs/log.txt.csv-energy.csv
Normal file
|
@ -0,0 +1 @@
|
||||||
|
node,energy
|
|
1
ns3-simulations/logs/log.txt.csv-energy.csv-energy.csv
Normal file
1
ns3-simulations/logs/log.txt.csv-energy.csv-energy.csv
Normal file
|
@ -0,0 +1 @@
|
||||||
|
node,energy
|
|
1961
ns3-simulations/logs/ns-3_1SSI_10SPS_2SN_2NH_10LB_10LL.org
Normal file
1961
ns3-simulations/logs/ns-3_1SSI_10SPS_2SN_2NH_10LB_10LL.org
Normal file
File diff suppressed because it is too large
Load diff
1
ns3-simulations/ns-3_1SSI_10SPS_2SN_2NH_10LB_10LL.org
Normal file
1
ns3-simulations/ns-3_1SSI_10SPS_2SN_2NH_10LB_10LL.org
Normal file
|
@ -0,0 +1 @@
|
||||||
|
#TITLE: mer. avril 24 16:37:06 CEST 2019 ns-3 simulation
|
|
@ -61,6 +61,6 @@ void setupCloudEnergy(CloudInfos cloudInfos){
|
||||||
completeNetdeviceEnergy.Install(cloudNodes);
|
completeNetdeviceEnergy.Install(cloudNodes);
|
||||||
|
|
||||||
ns3::ConsumptionLogger conso;
|
ns3::ConsumptionLogger conso;
|
||||||
conso.NodeConso(ns3::Seconds (1), ns3::Seconds(10), cloudNodes);
|
conso.NodeConso(ns3::Seconds (ECOFEN_LOG_EVERY), ns3::Seconds(ECOFEN_LOG_UNTIL), cloudNodes);
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,6 +31,10 @@
|
||||||
#include <utility> // To use std::pair
|
#include <utility> // To use std::pair
|
||||||
#include <iomanip> // To use std::setw
|
#include <iomanip> // To use std::setw
|
||||||
|
|
||||||
|
// ECOFEN
|
||||||
|
#define ECOFEN_LOG_UNTIL 1
|
||||||
|
#define ECOFEN_LOG_EVERY 0.1
|
||||||
|
|
||||||
// WIFI Energy Values
|
// WIFI Energy Values
|
||||||
#define BASICENERGYSOURCEINITIALENERGYJ 1000
|
#define BASICENERGYSOURCEINITIALENERGYJ 1000
|
||||||
#define BASICENERGYSUPPLYVOLTAGEV 3.3
|
#define BASICENERGYSUPPLYVOLTAGEV 3.3
|
||||||
|
@ -41,7 +45,7 @@
|
||||||
// Cloud Energy Values
|
// Cloud Energy Values
|
||||||
#define ONCONSO 0
|
#define ONCONSO 0
|
||||||
#define OFFCONSO 0
|
#define OFFCONSO 0
|
||||||
#define IDLECONSO 0
|
#define IDLECONSO 1
|
||||||
#define RECVBYTEENERGY 10
|
#define RECVBYTEENERGY 10
|
||||||
#define SENTBYTEENERGY 10
|
#define SENTBYTEENERGY 10
|
||||||
#define RECVPKTENERGY 10
|
#define RECVPKTENERGY 10
|
Binary file not shown.
59
ns3-simulations/parseEnergy.awk
Executable file
59
ns3-simulations/parseEnergy.awk
Executable file
|
@ -0,0 +1,59 @@
|
||||||
|
#!/bin/awk -f
|
||||||
|
|
||||||
|
BEGIN {
|
||||||
|
durationECOFEN=0
|
||||||
|
}
|
||||||
|
|
||||||
|
# For ECOFEN energy model
|
||||||
|
/Node [0-9]+ Conso/ {
|
||||||
|
if (!($4 in energyECOFEN)){
|
||||||
|
energyECOFEN[$4]=$6
|
||||||
|
countECOFEN[$4]=1
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
energyECOFEN[$4]=$6+energyECOFEN[$4]
|
||||||
|
countECOFEN[$4]++
|
||||||
|
}
|
||||||
|
durationECOFEN=$2
|
||||||
|
}
|
||||||
|
|
||||||
|
# For WIFI ns-3 energy model
|
||||||
|
/Node [0-9]+ consumes/ {
|
||||||
|
gsub("J","",$4) # Remove trailling Joule symbol
|
||||||
|
if (!($2 in energy)){
|
||||||
|
energyWIFI[$2]=$4
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
energyWIFI[$2]=$4+energyWIFI[$2]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
END {
|
||||||
|
# Extract ECOFEN energy
|
||||||
|
for(key in energyECOFEN){
|
||||||
|
if (countECOFEN[key]>0){ # Otherwise: 0 division
|
||||||
|
overallEnergy[key]=energyECOFEN[key]/countECOFEN[key]*durationECOFEN
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
overallEnergy[key]=0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# Extract WIFI energy
|
||||||
|
for(key in energyWIFI){
|
||||||
|
if(key in overallEnergy){ # Combine WIFI+ECOFEN
|
||||||
|
overallEnergy[key]+=energyWIFI[key] # Add wifi to ECOFEN
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
overallEnergy[key]=energyWIFI[key] # Only add WIFI since there is no ECOFEN value
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# CSV output
|
||||||
|
print("node,energy")
|
||||||
|
for(key in overallEnergy){
|
||||||
|
print(key "," overallEnergy[key])
|
||||||
|
}
|
||||||
|
}
|
54
ns3-simulations/simulate.org
Normal file
54
ns3-simulations/simulate.org
Normal file
|
@ -0,0 +1,54 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
* Run simulations
|
||||||
|
|
||||||
|
|
||||||
|
** Single Run
|
||||||
|
#+BEGIN_SRC bash :noweb yes :results output
|
||||||
|
<<singleRun>>
|
||||||
|
run
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
|
#+RESULTS:
|
||||||
|
: sensorsSendInterval:1 sensorsPktSize:10 sensorsNumber:2 nbHop:2 linksBandwidth:10 linksLatency:10
|
||||||
|
|
||||||
|
|
||||||
|
#+NAME: singleRun
|
||||||
|
#+BEGIN_SRC bash :noweb yes
|
||||||
|
simulator="ns3-simulator/simulator"
|
||||||
|
parseEnergyScript="./parseEnergy.awk"
|
||||||
|
logFolder="logs/"
|
||||||
|
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${NS3_PATH}/build/lib
|
||||||
|
run () {
|
||||||
|
[ -z ${sensorsSendInterval+x} ] && sensorsSendInterval=1
|
||||||
|
[ -z ${sensorsPktSize+x} ] && sensorsPktSize=10
|
||||||
|
[ -z ${sensorsNumber+x} ] && sensorsNumber=2
|
||||||
|
[ -z ${nbHop+x} ] && nbHop=2
|
||||||
|
[ -z ${linksBandwidth+x} ] && linksBandwidth=10
|
||||||
|
[ -z ${linksLatency+x} ] && linksLatency=10
|
||||||
|
logFile="${logFolder}/ns-3_${sensorsSendInterval}SSI_${sensorsPktSize}SPS_${sensorsNumber}SN_${nbHop}NH_${linksBandwidth}LB_${linksLatency}LL.org"
|
||||||
|
simCMD="$simulator --sensorsSendInterval=${sensorsSendInterval} --sensorsPktSize=${sensorsPktSize} --sensorsNumber=${sensorsNumber} --nbHop=${nbHop} --linksBandwidth=${linksBandwidth} --linksLatency=${linksLatency} 2>&1"
|
||||||
|
log=$(bash -c "$simCMD")
|
||||||
|
|
||||||
|
|
||||||
|
echo -e "#+TITLE: $(date) ns-3 simulation\n" > $logFile
|
||||||
|
echo "* Full Command" >> $logFile
|
||||||
|
echo "$simCMD" >> $logFile
|
||||||
|
echo "* Output" >> $logFile
|
||||||
|
echo "$log" >> $logFile
|
||||||
|
echo "* Energy CSV" >> $logFile
|
||||||
|
echo "$log" | $parseEnergyScript >> $logFile
|
||||||
|
echo "* Metrics" >> $logFile
|
||||||
|
echo " sensorsSendInterval:${sensorsSendInterval} sensorsPktSize:${sensorsPktSize} sensorsNumber:${sensorsNumber} nbHop:${nbHop} linksBandwidth:${linksBandwidth} linksLatency:${linksLatency}" >> $logFile
|
||||||
|
|
||||||
|
}
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
|
#+RESULTS:
|
||||||
|
: Processing logs/logs/log.txt
|
||||||
|
: Processing logs/logs/log.txt.csv-energy.csv
|
||||||
|
: Processing logs/logs/log.txt.csv
|
||||||
|
: Processing logs/logs/log.txt-energy.csv
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue