mirror of
https://gitlab.com/manzerbredes/loosely-coupled-dss.git
synced 2025-04-05 11:06:25 +02:00
Improve data analysis and simulation
This commit is contained in:
parent
9c9be6752d
commit
1477290330
12 changed files with 38487 additions and 19293 deletions
|
@ -7,7 +7,13 @@ finalEnergy=data%>%group_by(simkey,wireless,wakeupfor)%>%summarize(wireless=firs
|
|||
finalStats=data%>%group_by(simkey,wireless,wakeupfor,seed)%>%
|
||||
summarise(success=sum(nSend),totalUptime=mean(totalUptime))%>%
|
||||
ungroup()%>%group_by(simkey,wireless,wakeupfor)%>%
|
||||
summarise(sd=sd(success),success=mean(success),totalUptime=first(totalUptime))
|
||||
summarise(sd_success=sd(success),success=mean(success),totalUptime=first(totalUptime))
|
||||
|
||||
# Sender energy
|
||||
senderEnergy=data%>%filter(isSender!=0)%>%group_by(simkey,wireless,wakeupfor)%>%summarise(senderEnergy=mean(energy))
|
||||
receiverEnergy=data%>%filter(isSender==0)%>%group_by(simkey,wireless,wakeupfor)%>%summarise(receiverEnergy=mean(energy))
|
||||
finalStats=finalStats%>%left_join(senderEnergy,by=c("simkey","wireless","wakeupfor"))
|
||||
finalStats=finalStats%>%left_join(receiverEnergy,by=c("simkey","wireless","wakeupfor"))
|
||||
|
||||
# Add nSendFail to stats
|
||||
sendFail=data%>%filter(node=="on0")%>%group_by(simkey,wireless,wakeupfor)%>%summarise(nSendFail=mean(nSendFail))
|
||||
|
@ -28,9 +34,9 @@ ggsave("energy.png")
|
|||
ggplot(finalStats,aes(x=simkey,y=success,fill=wireless))+
|
||||
geom_bar(stat="identity",position=position_dodge())+
|
||||
xlab("Scenarios")+ylab("Energy (J)")+
|
||||
geom_errorbar(position=position_dodge(0.9),aes(ymin=success-sd, ymax=success+sd),width=0.5,size=1.5,) +
|
||||
geom_text(aes(label = round(success+sd,digits=1), y= success+sd),vjust=-0.4,position=position_dodge(0.9))+
|
||||
geom_text(aes(label = round(success-sd,digits=1), y= success-sd),vjust=+1.5,position=position_dodge(0.9))+
|
||||
geom_errorbar(position=position_dodge(0.9),aes(ymin=success-sd_success, ymax=success+sd_success),width=0.5,size=1.5,) +
|
||||
geom_text(aes(label = round(success+sd_success,digits=1), y= success+sd_success),vjust=-0.4,position=position_dodge(0.9))+
|
||||
geom_text(aes(label = round(success-sd_success,digits=1), y= success-sd_success),vjust=+1.5,position=position_dodge(0.9))+
|
||||
geom_text(aes(label = round(success,digits=1), y= success/2),fontface="bold",colour="white",position=position_dodge(0.9))+
|
||||
facet_wrap(~ wakeupfor) +
|
||||
ggsave("success.png")
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 196 KiB After Width: | Height: | Size: 192 KiB |
|
@ -11,20 +11,33 @@ results="${wai}/results.csv"
|
|||
aheaders="simkey,wireless,wakeupfor"
|
||||
avalues="none,none,none"
|
||||
log_file="${wai}/logs/$(date +%s).org" && mkdir -p "${wai}/logs/"
|
||||
gen_log=0 # Should we generate logs ?
|
||||
|
||||
run-simulation () {
|
||||
# Generate inputs
|
||||
$scenarios $seed $simtime $wakeupevery $wakeupfor $n_nodes $extended $hint $poff $pon $prx $ptx $datasize $bitrate > "$inputs"
|
||||
$scenarios $seed $simtime $wakeupevery $wakeupfor $n_nodes $extended $hint $poff $pon $prx $ptx $datasize $bitrate $hintsize > "$inputs"
|
||||
|
||||
# Init logs
|
||||
echo -e "* seed=$seed simtime=$simtime wakeupevery=$wakeupevery wakeupfor=$wakeupfor n_nodes=$n_nodes extended=$extended hint=$hint poff=$poff pon=$pon prx=$prx ptx=$ptx datasize=$datasize bitrate=$bitrate \n" >> "${log_file}"
|
||||
[ $gen_log -eq 1 ] && echo -e "* seed=$seed simtime=$simtime wakeupevery=$wakeupevery wakeupfor=$wakeupfor n_nodes=$n_nodes extended=$extended hint=$hint poff=$poff pon=$pon prx=$prx ptx=$ptx datasize=$datasize bitrate=$bitrate \n" >> "${log_file}"
|
||||
|
||||
# Run simulations
|
||||
if [ -e "$results" ]
|
||||
if [ -e "$results" ]
|
||||
then
|
||||
$simulator 2>&1 | tee -a "${log_file}" | $parser | sed 1d | sed "s/$/,${avalues}/" >> "$results"
|
||||
# Create new result file
|
||||
if [ $gen_log -eq 1 ]
|
||||
then
|
||||
$simulator 2>&1 | tee -a "${log_file}" | $parser | sed 1d | sed "s/$/,${avalues}/" >> "$results"
|
||||
else
|
||||
$simulator 2>&1 | $parser | sed 1d | sed "s/$/,${avalues}/" >> "$results"
|
||||
fi
|
||||
else
|
||||
$simulator 2>&1 | tee -a "${log_file}" | $parser | sed "1 s/$/,${aheaders}/g" | sed "2,\$s/$/,${avalues}/" > "$results"
|
||||
# Use existing result file
|
||||
if [ $gen_log -eq 1 ]
|
||||
then
|
||||
$simulator 2>&1 | tee -a "${log_file}" | $parser | sed "1 s/$/,${aheaders}/g" | sed "2,\$s/$/,${avalues}/" > "$results"
|
||||
else
|
||||
$simulator 2>&1 | $parser | sed "1 s/$/,${aheaders}/g" | sed "2,\$s/$/,${avalues}/" > "$results"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
|
@ -40,12 +53,13 @@ poff=0
|
|||
pon=0.4
|
||||
prx=0.16
|
||||
ptx=0.16
|
||||
datasize=1000000 # MB
|
||||
datasize=1000000 # 1MB
|
||||
hintsize=4
|
||||
bitrate="100kbps"
|
||||
|
||||
run-scenarios() {
|
||||
# Configure number of seed per scenarios
|
||||
nseed=100
|
||||
nseed=200
|
||||
|
||||
# Baseline
|
||||
echo "Baseline..."
|
||||
|
|
57602
results/results.csv
57602
results/results.csv
File diff suppressed because it is too large
Load diff
Binary file not shown.
Before Width: | Height: | Size: 122 KiB After Width: | Height: | Size: 124 KiB |
|
@ -1,33 +1,33 @@
|
|||
|
||||
|simkey |wireless | wakeupfor| sd| energy|
|
||||
|:---------------|:--------|---------:|----------:|--------:|
|
||||
|baseline |lora | 60| 0.2266042| 230.3920|
|
||||
|extended |lora | 60| 50.7186446| 606.5560|
|
||||
|hint |lora | 60| 0.2266042| 230.3920|
|
||||
|hintandextended |lora | 60| 52.7539403| 617.1553|
|
||||
|baseline |lora | 60| 0.2634068| 230.3887|
|
||||
|extended |lora | 60| 51.9816535| 607.6238|
|
||||
|hint |lora | 60| 0.2634068| 230.3887|
|
||||
|hintandextended |lora | 60| 53.7777737| 618.4900|
|
||||
|
||||
|
||||
|simkey |wireless | wakeupfor| sd| energy|
|
||||
|:---------------|:--------|---------:|----------:|--------:|
|
||||
|baseline |nbiot | 60| 0.9205795| 935.9675|
|
||||
|extended |nbiot | 60| 51.9906616| 607.3420|
|
||||
|hint |nbiot | 60| 0.9205795| 935.9675|
|
||||
|hintandextended |nbiot | 60| 53.9800436| 617.9613|
|
||||
|simkey |wireless | wakeupfor| sd| energy|
|
||||
|:---------------|:--------|---------:|--------:|--------:|
|
||||
|baseline |nbiot | 60| 1.07009| 935.9540|
|
||||
|extended |nbiot | 60| 53.27926| 608.4093|
|
||||
|hint |nbiot | 60| 1.07009| 935.9540|
|
||||
|hintandextended |nbiot | 60| 55.03198| 619.2855|
|
||||
|
||||
|
||||
|simkey |wireless | wakeupfor| sd| energy|
|
||||
|:---------------|:--------|---------:|---------:|---------:|
|
||||
|baseline |lora | 180| 2.276321| 690.8349|
|
||||
|extended |lora | 180| 34.623157| 1723.1557|
|
||||
|hint |lora | 180| 2.276321| 690.8349|
|
||||
|hintandextended |lora | 180| 51.402788| 1776.4173|
|
||||
|baseline |lora | 180| 2.098041| 690.8962|
|
||||
|extended |lora | 180| 33.540734| 1723.2080|
|
||||
|hint |lora | 180| 2.098041| 690.8962|
|
||||
|hintandextended |lora | 180| 50.926989| 1776.6692|
|
||||
|
||||
|
||||
|simkey |wireless | wakeupfor| sd| energy|
|
||||
|:---------------|:--------|---------:|---------:|--------:|
|
||||
|baseline |nbiot | 180| 387.22964| 2401.296|
|
||||
|extended |nbiot | 180| 89.44436| 1774.901|
|
||||
|hint |nbiot | 180| 360.14353| 2443.371|
|
||||
|hintandextended |nbiot | 180| 78.21175| 1831.326|
|
||||
|baseline |nbiot | 180| 386.27160| 2401.949|
|
||||
|extended |nbiot | 180| 90.74053| 1775.798|
|
||||
|hint |nbiot | 180| 360.02430| 2444.367|
|
||||
|hintandextended |nbiot | 180| 79.12560| 1832.423|
|
||||
|
||||
|
||||
|
|
|
@ -1,33 +1,33 @@
|
|||
|
||||
|simkey |wireless | wakeupfor| sd| success| totalUptime| nSendFail|
|
||||
|:---------------|:--------|---------:|--------:|-------:|-----------:|---------:|
|
||||
|baseline |lora | 60| 0.000000| 0.00| 1440.000| 28.41|
|
||||
|extended |lora | 60| 1.598105| 5.54| 1717.583| 18.46|
|
||||
|hint |lora | 60| 0.000000| 0.00| 1440.000| 28.41|
|
||||
|hintandextended |lora | 60| 1.598105| 5.54| 1747.583| 18.46|
|
||||
|simkey |wireless | wakeupfor| sd_success| success| totalUptime| senderEnergy| receiverEnergy| nSendFail|
|
||||
|:---------------|:--------|---------:|----------:|-------:|-----------:|------------:|--------------:|---------:|
|
||||
|baseline |lora | 60| 0.000000| 0.000| 1440.000| 230.4000| 230.3876| 28.435|
|
||||
|extended |lora | 60| 1.513548| 5.725| 1717.583| 762.2560| 593.5664| 18.275|
|
||||
|hint |lora | 60| 0.000000| 0.000| 1440.000| 230.4000| 230.3876| 28.435|
|
||||
|hintandextended |lora | 60| 1.513548| 5.725| 1747.585| 762.2571| 605.4203| 18.275|
|
||||
|
||||
|
||||
|simkey |wireless | wakeupfor| sd| success| totalUptime| nSendFail|
|
||||
|:---------------|:--------|---------:|--------:|-------:|-----------:|---------:|
|
||||
|baseline |nbiot | 60| 0.000000| 0.00| 1440.000| 28.41|
|
||||
|extended |nbiot | 60| 1.591486| 5.55| 1477.583| 18.45|
|
||||
|hint |nbiot | 60| 0.000000| 0.00| 1440.000| 28.41|
|
||||
|hintandextended |nbiot | 60| 1.591486| 5.55| 1507.583| 18.45|
|
||||
|simkey |wireless | wakeupfor| sd_success| success| totalUptime| senderEnergy| receiverEnergy| nSendFail|
|
||||
|:---------------|:--------|---------:|----------:|-------:|-----------:|------------:|--------------:|---------:|
|
||||
|baseline |nbiot | 60| 0.000000| 0.00| 1440.000| 936.0000| 935.9498| 28.435|
|
||||
|extended |nbiot | 60| 1.509468| 5.73| 1477.583| 767.0540| 593.9871| 18.270|
|
||||
|hint |nbiot | 60| 0.000000| 0.00| 1440.000| 936.0000| 935.9498| 28.435|
|
||||
|hintandextended |nbiot | 60| 1.509468| 5.73| 1507.584| 767.0551| 605.8519| 18.270|
|
||||
|
||||
|
||||
|simkey |wireless | wakeupfor| sd| success| totalUptime| nSendFail|
|
||||
|:---------------|:--------|---------:|-------:|-------:|-----------:|---------:|
|
||||
|baseline |lora | 180| 0.00000| 0.00| 4320.000| 37.05|
|
||||
|extended |lora | 180| 1.25352| 9.38| 4622.083| 14.03|
|
||||
|hint |lora | 180| 0.00000| 0.00| 4320.000| 37.05|
|
||||
|hintandextended |lora | 180| 1.25352| 9.38| 4772.083| 14.03|
|
||||
|simkey |wireless | wakeupfor| sd_success| success| totalUptime| senderEnergy| receiverEnergy| nSendFail|
|
||||
|:---------------|:--------|---------:|----------:|-------:|-----------:|------------:|--------------:|---------:|
|
||||
|baseline |lora | 180| 0.000000| 0.00| 4320.000| 691.1912| 690.8694| 37.155|
|
||||
|extended |lora | 180| 1.124197| 9.45| 4622.083| 1671.5060| 1727.9082| 14.015|
|
||||
|hint |lora | 180| 0.000000| 0.00| 4320.000| 691.1912| 690.8694| 37.155|
|
||||
|hintandextended |lora | 180| 1.124197| 9.45| 4772.085| 1671.5079| 1786.2293| 14.015|
|
||||
|
||||
|
||||
|simkey |wireless | wakeupfor| sd| success| totalUptime| nSendFail|
|
||||
|:---------------|:--------|---------:|--------:|-------:|-----------:|---------:|
|
||||
|baseline |nbiot | 180| 1.616956| 7.54| 4320.000| 27.93|
|
||||
|extended |nbiot | 180| 1.157147| 9.88| 4334.750| 19.33|
|
||||
|hint |nbiot | 180| 1.616956| 7.54| 4440.000| 27.93|
|
||||
|hintandextended |nbiot | 180| 1.157147| 9.88| 4474.167| 19.33|
|
||||
|simkey |wireless | wakeupfor| sd_success| success| totalUptime| senderEnergy| receiverEnergy| nSendFail|
|
||||
|:---------------|:--------|---------:|----------:|-------:|-----------:|------------:|--------------:|---------:|
|
||||
|baseline |nbiot | 180| 1.530059| 7.675| 4320.000| 2804.485| 2365.354| 28.01|
|
||||
|extended |nbiot | 180| 1.058004| 9.965| 4334.750| 2071.203| 1748.943| 19.21|
|
||||
|hint |nbiot | 180| 1.530059| 7.675| 4440.000| 2804.486| 2411.629| 28.01|
|
||||
|hintandextended |nbiot | 180| 1.058004| 9.965| 4474.167| 2071.204| 1810.716| 19.21|
|
||||
|
||||
|
||||
|
|
|
@ -1,33 +0,0 @@
|
|||
|
||||
|simkey |wireless | wakeupfor| sd| energy|
|
||||
|:---------------|:--------|---------:|----------:|--------:|
|
||||
|baseline |lora | 60| 0.2266042| 230.3920|
|
||||
|extended |lora | 60| 50.7186446| 606.5560|
|
||||
|hint |lora | 60| 0.2266042| 230.3920|
|
||||
|hintandextended |lora | 60| 52.7539403| 617.1553|
|
||||
|
||||
|
||||
|simkey |wireless | wakeupfor| sd| energy|
|
||||
|:---------------|:--------|---------:|----------:|--------:|
|
||||
|baseline |nbiot | 60| 0.9205795| 935.9675|
|
||||
|extended |nbiot | 60| 51.9906616| 607.3420|
|
||||
|hint |nbiot | 60| 0.9205795| 935.9675|
|
||||
|hintandextended |nbiot | 60| 53.9800436| 617.9613|
|
||||
|
||||
|
||||
|simkey |wireless | wakeupfor| sd| energy|
|
||||
|:---------------|:--------|---------:|---------:|---------:|
|
||||
|baseline |lora | 180| 2.276321| 690.8349|
|
||||
|extended |lora | 180| 34.623157| 1723.1557|
|
||||
|hint |lora | 180| 2.276321| 690.8349|
|
||||
|hintandextended |lora | 180| 51.402788| 1776.4173|
|
||||
|
||||
|
||||
|simkey |wireless | wakeupfor| sd| energy|
|
||||
|:---------------|:--------|---------:|---------:|--------:|
|
||||
|baseline |nbiot | 180| 387.22964| 2401.296|
|
||||
|extended |nbiot | 180| 89.44436| 1774.901|
|
||||
|hint |nbiot | 180| 360.14353| 2443.371|
|
||||
|hintandextended |nbiot | 180| 78.21175| 1831.326|
|
||||
|
||||
|
|
@ -18,6 +18,7 @@ Inputs::Inputs(std::string node_name){
|
|||
data_size=d["nodes"][node_name.c_str()]["data_size"].GetInt();
|
||||
extended=d["extended"].GetBool();
|
||||
seed=d["seed"].GetInt();
|
||||
hint_size=d["hint_size"].GetInt();
|
||||
n_nodes=d["nodes"].MemberCount();
|
||||
|
||||
// Instantiate wake_ts
|
||||
|
|
|
@ -77,6 +77,7 @@ public:
|
|||
bool use_hint;
|
||||
bool extended;
|
||||
int data_size;
|
||||
int hint_size;
|
||||
int seed;
|
||||
int n_nodes;
|
||||
};
|
|
@ -17,10 +17,10 @@ using namespace rapidjson;
|
|||
|
||||
int main(int argc, char **argv){
|
||||
// Setup seed
|
||||
if(argc!=14){
|
||||
if(argc!=15){
|
||||
cerr << "Usage: " << argv[0] <<
|
||||
" <seed> <simtime> <wakeupevery> <wakeupfor> <n_nodes>" <<
|
||||
" <extended> <hint> <poff> <pon> <prx> <ptx> <datasize> <bitrate>" <<
|
||||
" <extended> <hint> <poff> <pon> <prx> <ptx> <datasize> <bitrate> <hintsize>" <<
|
||||
endl;
|
||||
exit(1);
|
||||
}
|
||||
|
@ -39,6 +39,7 @@ int main(int argc, char **argv){
|
|||
double ptx=stod(argv[11]);
|
||||
unsigned int datasize=atoi(argv[12]);
|
||||
string bitrate(argv[13]);
|
||||
unsigned int hintsize=atoi(argv[14]);
|
||||
|
||||
|
||||
// Setup seed
|
||||
|
@ -52,6 +53,7 @@ int main(int argc, char **argv){
|
|||
simkeyValue.SetString(bitrate.c_str(),bitrate.size(),d.GetAllocator());
|
||||
d.AddMember("bitrate",simkeyValue,d.GetAllocator());
|
||||
d.AddMember("extended",extended,d.GetAllocator());
|
||||
d.AddMember("hint_size",hintsize,d.GetAllocator());
|
||||
|
||||
// Create nodes
|
||||
Value nodes(kObjectType);
|
||||
|
|
|
@ -27,9 +27,10 @@ typedef unsigned int u32;
|
|||
*/
|
||||
class Payload{
|
||||
public:
|
||||
Payload():hint(0),duration(0),containsHint(false){}
|
||||
Payload():hint(0),duration(0),containsHint(false),size(0){}
|
||||
double hint;
|
||||
double duration;
|
||||
int size;
|
||||
bool containsHint;
|
||||
std::string node;
|
||||
};
|
||||
|
@ -109,10 +110,12 @@ static void obs_node(std::vector<std::string> args) {
|
|||
if(isSender){ // If I am a sender
|
||||
Payload *p=new Payload();
|
||||
p->node=selfName;
|
||||
p->size=data_size;
|
||||
if(useHint&&i.HasNext()){
|
||||
p->containsHint=true;
|
||||
p->hint=i.GetNextTS();
|
||||
p->duration=i.GetNextDuration();
|
||||
p->size=data_size+i.hint_size;
|
||||
}
|
||||
if(i.extended){
|
||||
// We use a trick here
|
||||
|
@ -124,11 +127,11 @@ static void obs_node(std::vector<std::string> args) {
|
|||
m->put(p,0,uptime);
|
||||
simgrid::s4u::Mailbox *m_ext= simgrid::s4u::Mailbox::by_name("medium"+selfName);
|
||||
MODE_TX();
|
||||
m_ext->put(p,data_size);
|
||||
m_ext->put(p,p->size);
|
||||
}
|
||||
else{
|
||||
MODE_TX();
|
||||
m->put(p,data_size,uptime);
|
||||
m->put(p,p->size,uptime);
|
||||
}
|
||||
nSend++;
|
||||
isSender=(nSend<(i.n_nodes-1));
|
||||
|
@ -186,5 +189,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|totalUptime:%f|seed:%d)",selfName.c_str(),selfName.c_str(),nSend,nWakeUp,nDataRcv,nSendFail,nRcvFail,totalUptime,i.seed);
|
||||
XBT_INFO("Observation node %s finished [LOG2PARSE](node:%s|isSender:%d|nSend:%d|nWakeUp:%d|nDataRcv:%d|nSendFail:%d|nRcvFail:%d|totalUptime:%f|seed:%d)",selfName.c_str(),selfName.c_str(),i.is_sender,nSend,nWakeUp,nDataRcv,nSendFail,nRcvFail,totalUptime,i.seed);
|
||||
}
|
Loading…
Add table
Reference in a new issue