mirror of
https://gitlab.com/manzerbredes/loosely-coupled-dss.git
synced 2025-04-05 11:06:25 +02:00
Improve scenarios and analysis
This commit is contained in:
parent
51d0c256a3
commit
bf8117d3aa
7 changed files with 2033 additions and 475 deletions
|
@ -1,10 +1,17 @@
|
|||
library("tidyverse")
|
||||
|
||||
library("knitr")
|
||||
|
||||
data=read_csv("results.csv")
|
||||
|
||||
final=data%>%group_by(simkey)%>%summarize(energy=mean(energy),sd=sd(energy))
|
||||
final=data%>%group_by(simkey,wireless,wakeupfor)%>%summarize(energy=mean(energy),wireless=first(wireless),sd=sd(energy),wakeupfor=first(wakeupfor))
|
||||
|
||||
ggplot(final,aes(x=simkey,y=energy))+geom_bar(stat="identity")+
|
||||
xlab("Scenario")+ylab("Energy (J)")+
|
||||
geom_errorbar(aes(ymin=energy-sd, ymax=energy+sd),width=.2,size=1.5)
|
||||
ggplot(final,aes(x=simkey,y=energy))+
|
||||
geom_bar(stat="identity",aes(fill=wireless),position=position_dodge())+
|
||||
xlab("Scenarios")+ylab("Energy (J)")+
|
||||
geom_errorbar(aes(ymin=energy-sd, ymax=energy+sd),width=.2,size=1.5) +
|
||||
facet_wrap(~ wakeupfor)
|
||||
|
||||
for(wake in unique(data$wakeupfor)){
|
||||
print(kable(final%>%filter(wireless=="lora",wakeupfor==wake)))
|
||||
print(kable(final%>%filter(wireless!="lora",wakeupfor==wake)))
|
||||
}
|
||||
|
|
122
results/paper.sh
122
results/paper.sh
|
@ -8,68 +8,102 @@ inputs="${wai}/../inputs.json"
|
|||
simulator="make -C ${wai}/../ run"
|
||||
parser="${wai}/../parser.awk"
|
||||
results="${wai}/results.csv"
|
||||
nseed=20
|
||||
aheaders="simkey,wireless,wakeupfor"
|
||||
avalues="none,none,none"
|
||||
|
||||
run-simulation () {
|
||||
# Generate inputs
|
||||
$scenarios $seed $simtime $wakeupsd $wakeupevery $wakeupfor $n_nodes $extended $hint $poff $pon $prx $ptx $datasize $simkey > "$inputs"
|
||||
$scenarios $seed $simtime $wakeupevery $wakeupfor $n_nodes $extended $hint $poff $pon $prx $ptx $datasize $bitrate > "$inputs"
|
||||
# Run simulations
|
||||
[ -e "$results" ] && { $simulator 2>&1 | $parser | sed 1d >> "$results"; } || { $simulator 2>&1 | $parser > "$results"; }
|
||||
if [ -e "$results" ]
|
||||
then
|
||||
$simulator 2>&1 | $parser | sed 1d | sed "s/$/,${avalues}/" >> "$results"
|
||||
else
|
||||
$simulator 2>&1 | $parser | sed "1 s/$/,${aheaders}/g" | sed "2,\$s/$/,${avalues}/" > "$results"
|
||||
fi
|
||||
}
|
||||
|
||||
# Default Parameters
|
||||
seed=0
|
||||
simtime=7200
|
||||
wakeupsd=180
|
||||
wakeupevery=600
|
||||
simtime=86400 # One day
|
||||
wakeupevery=3600
|
||||
wakeupfor=180
|
||||
n_nodes=5
|
||||
n_nodes=12
|
||||
extended="false"
|
||||
hint="false"
|
||||
poff=0
|
||||
pon=0.4
|
||||
prx=0.16
|
||||
ptx=0.16
|
||||
datasize=1000000
|
||||
simkey=0
|
||||
datasize=1000000 # MB
|
||||
bitrate="100kbps"
|
||||
|
||||
# Baseline
|
||||
echo "Baseline..."
|
||||
run-scenarios() {
|
||||
# Configure number of seed per scenarios
|
||||
nseed=10
|
||||
|
||||
# Baseline
|
||||
echo "Baseline..."
|
||||
avalues="baseline,$wireless,$wakeupfor"
|
||||
for seed in $(seq 1 $nseed)
|
||||
do
|
||||
run-simulation
|
||||
done
|
||||
|
||||
# Hint
|
||||
echo "Hint..."
|
||||
hint="true"
|
||||
avalues="hint,$wireless,$wakeupfor"
|
||||
for seed in $(seq 1 $nseed)
|
||||
do
|
||||
run-simulation
|
||||
done
|
||||
hint="false"
|
||||
|
||||
# Extended
|
||||
echo "Extended..."
|
||||
extended="true"
|
||||
avalues="extended,$wireless,$wakeupfor"
|
||||
for seed in $(seq 1 $nseed)
|
||||
do
|
||||
run-simulation
|
||||
done
|
||||
extended="false"
|
||||
|
||||
# Hint+Extended
|
||||
echo "Hint + Extended..."
|
||||
extended="true"
|
||||
hint="true"
|
||||
avalues="hintandextended,$wireless,$wakeupfor"
|
||||
for seed in $(seq 1 $nseed)
|
||||
do
|
||||
run-simulation
|
||||
done
|
||||
extended="false"
|
||||
hint="false"
|
||||
}
|
||||
|
||||
# Clean previous runs
|
||||
[ -e "${results}" ] && rm "${results}"
|
||||
simkey="baseline"
|
||||
for seed in $(seq 1 $nseed)
|
||||
do
|
||||
run-simulation
|
||||
done
|
||||
|
||||
# Hint
|
||||
echo "Hint..."
|
||||
hint="true"
|
||||
simkey="hint"
|
||||
for seed in $(seq 1 $nseed)
|
||||
for wakeupfor in 60 180
|
||||
do
|
||||
run-simulation
|
||||
done
|
||||
hint="false"
|
||||
|
||||
# Extended
|
||||
echo "Extended..."
|
||||
extended="true"
|
||||
simkey="extended"
|
||||
for seed in $(seq 1 $nseed)
|
||||
do
|
||||
run-simulation
|
||||
done
|
||||
extended="false"
|
||||
# Lora
|
||||
echo "----- Run Lora ($wakeupfor) -----"
|
||||
wireless="lora"
|
||||
bitrate="50kbps"
|
||||
pon=0.4
|
||||
prx=0.16
|
||||
ptx=0.16
|
||||
run-scenarios
|
||||
|
||||
# Hint+Extended
|
||||
echo "Hint + Extended..."
|
||||
extended="true"
|
||||
hint="true"
|
||||
simkey="hintandextended"
|
||||
for seed in $(seq 1 $nseed)
|
||||
do
|
||||
run-simulation
|
||||
done
|
||||
extended="false"
|
||||
hint="false"
|
||||
# NbIot
|
||||
echo "----- Run NbIoT ($wakeupfor) -----"
|
||||
wireless="nbiot"
|
||||
bitrate="200kbps"
|
||||
pon=0.4
|
||||
prx=0.65
|
||||
ptx=0.65
|
||||
run-scenarios
|
||||
done
|
2322
results/results.csv
2322
results/results.csv
File diff suppressed because it is too large
Load diff
|
@ -17,7 +17,6 @@ Inputs::Inputs(std::string node_name){
|
|||
use_hint=d["nodes"][node_name.c_str()]["use_hint"].GetBool();
|
||||
data_size=d["nodes"][node_name.c_str()]["data_size"].GetInt();
|
||||
extended=d["extended"].GetBool();
|
||||
simkey=d["simkey"].GetString();
|
||||
seed=d["seed"].GetInt();
|
||||
n_nodes=d["nodes"].MemberCount();
|
||||
|
||||
|
@ -156,7 +155,7 @@ void Inputs::GeneratePlatform(std::string p){
|
|||
pf << "<?xml version='1.0'?>\n";
|
||||
pf << "<!DOCTYPE platform SYSTEM \"http://simgrid.gforge.inria.fr/simgrid/simgrid.dtd\">\n";
|
||||
pf << "<platform version=\"4.1\">\n <AS id=\"AS0\" routing=\"Cluster\">\n";
|
||||
pf << " <link id=\"link\" bandwidth=\"1Mbps\" latency=\"0ms\" sharing_policy=\"SHARED\"></link>\n";
|
||||
pf << " <link id=\"link\" bandwidth=\""<<d["bitrate"].GetString()<<"\" latency=\"0ms\" sharing_policy=\"SHARED\"></link>\n";
|
||||
for (Value::ConstMemberIterator itr = d["nodes"].MemberBegin(); itr != d["nodes"].MemberEnd(); ++itr)
|
||||
{
|
||||
std::string name=itr->name.GetString();
|
||||
|
|
|
@ -79,6 +79,4 @@ public:
|
|||
int data_size;
|
||||
int seed;
|
||||
int n_nodes;
|
||||
std::string simkey;
|
||||
|
||||
};
|
|
@ -17,10 +17,10 @@ using namespace rapidjson;
|
|||
|
||||
int main(int argc, char **argv){
|
||||
// Setup seed
|
||||
if(argc!=15){
|
||||
if(argc!=14){
|
||||
cerr << "Usage: " << argv[0] <<
|
||||
" <seed> <simtime> <wakeupsd> <wakeupevery> <wakeupfor> <n_nodes>" <<
|
||||
" <extended> <hint> <poff> <pon> <prx> <ptx> <datasize> <simkey>" <<
|
||||
" <seed> <simtime> <wakeupevery> <wakeupfor> <n_nodes>" <<
|
||||
" <extended> <hint> <poff> <pon> <prx> <ptx> <datasize> <bitrate>" <<
|
||||
endl;
|
||||
exit(1);
|
||||
}
|
||||
|
@ -28,18 +28,18 @@ int main(int argc, char **argv){
|
|||
// Init parameters
|
||||
int seed=atoi(argv[1]);
|
||||
double simtime=stod(argv[2]);
|
||||
unsigned int wakeupsd=atoi(argv[3]);
|
||||
unsigned int wakeupevery=atoi(argv[4]);
|
||||
double wakeupfor=stod(argv[5]);
|
||||
unsigned int n_nodes=atoi(argv[6]);
|
||||
bool extended=!strcmp("true",argv[7]);
|
||||
bool hint=!strcmp("true",argv[8]);
|
||||
double poff=stod(argv[9]);
|
||||
double pon=stod(argv[10]);
|
||||
double prx=stod(argv[11]);
|
||||
double ptx=stod(argv[12]);
|
||||
unsigned int datasize=atoi(argv[13]);
|
||||
string simkey(argv[14]);
|
||||
unsigned int wakeupevery=atoi(argv[3]);
|
||||
double wakeupfor=stod(argv[4]);
|
||||
unsigned int n_nodes=atoi(argv[5]);
|
||||
bool extended=!strcmp("true",argv[6]);
|
||||
bool hint=!strcmp("true",argv[7]);
|
||||
double poff=stod(argv[8]);
|
||||
double pon=stod(argv[9]);
|
||||
double prx=stod(argv[10]);
|
||||
double ptx=stod(argv[11]);
|
||||
unsigned int datasize=atoi(argv[12]);
|
||||
string bitrate(argv[13]);
|
||||
|
||||
|
||||
// Setup seed
|
||||
srand(seed);
|
||||
|
@ -47,10 +47,10 @@ int main(int argc, char **argv){
|
|||
// Create document
|
||||
Document d;
|
||||
d.SetObject();
|
||||
Value simkeyValue;
|
||||
simkeyValue.SetString(simkey.c_str(),simkey.size(),d.GetAllocator());
|
||||
d.AddMember("simkey",simkeyValue,d.GetAllocator());
|
||||
d.AddMember("seed",Value().SetInt(seed),d.GetAllocator());
|
||||
Value simkeyValue;
|
||||
simkeyValue.SetString(bitrate.c_str(),bitrate.size(),d.GetAllocator());
|
||||
d.AddMember("bitrate",simkeyValue,d.GetAllocator());
|
||||
d.AddMember("extended",extended,d.GetAllocator());
|
||||
|
||||
// Create nodes
|
||||
|
@ -69,8 +69,8 @@ int main(int argc, char **argv){
|
|||
// Setup ts and durations
|
||||
Value ts(kArrayType);
|
||||
Value duration(kArrayType);
|
||||
for(unsigned int i=0;(i+wakeupfor)<simtime;i+=RAND(wakeupevery-wakeupsd,wakeupevery+wakeupsd)){
|
||||
ts.PushBack(Value().SetDouble(i),d.GetAllocator());
|
||||
for(unsigned int i=0;i<simtime;i+=wakeupevery){
|
||||
ts.PushBack(Value().SetDouble(RAND(i,i+wakeupevery)),d.GetAllocator());
|
||||
duration.PushBack(Value().SetDouble(wakeupfor),d.GetAllocator());
|
||||
}
|
||||
node.AddMember("wake_ts",ts,d.GetAllocator());
|
||||
|
|
|
@ -183,5 +183,5 @@ static void obs_node(std::vector<std::string> args) {
|
|||
}
|
||||
// Done
|
||||
MODE_OFF()
|
||||
XBT_INFO("Observation node %s finished [LOG2PARSE](node:%s|nSend:%d|nWakeUp:%d|nDataRcv:%d|nSendFail:%d|nRcvFail:%d|simkey:%s|seed:%d)",selfName.c_str(),selfName.c_str(),nSend,nWakeUp,nDataRcv,nSendFail,nRcvFail,i.simkey.c_str(),i.seed);
|
||||
XBT_INFO("Observation node %s finished [LOG2PARSE](node:%s|nSend:%d|nWakeUp:%d|nDataRcv:%d|nSendFail:%d|nRcvFail:%d|seed:%d)",selfName.c_str(),selfName.c_str(),nSend,nWakeUp,nDataRcv,nSendFail,nRcvFail,i.seed);
|
||||
}
|
Loading…
Add table
Reference in a new issue