Refresh all scenarios

This commit is contained in:
Loic Guegan 2021-05-12 10:05:19 +02:00
parent fd4197731a
commit 454d01dc84
8 changed files with 16597 additions and 16617 deletions

View file

@ -5,9 +5,9 @@ data=read_csv("results.csv")
finalEnergy=data%>%group_by(simkey,wireless,wakeupfor)%>%summarize(wireless=first(wireless),sd=sd(energy),wakeupfor=first(wakeupfor),energy=mean(energy))
finalStats=data%>%group_by(simkey,wireless,wakeupfor,seed)%>%
summarise(success=sum(nSend),totalUptime=mean(totalUptime))%>%
summarise(success=sum(nSend))%>%
ungroup()%>%group_by(simkey,wireless,wakeupfor)%>%
summarise(sd_success=sd(success),success=mean(success),totalUptime=first(totalUptime))
summarise(sd_success=sd(success),success=mean(success))
# Sender energy
senderEnergy=data%>%filter(isSender!=0)%>%group_by(simkey,wireless,wakeupfor)%>%summarise(senderEnergy=mean(energy))
@ -15,6 +15,13 @@ receiverEnergy=data%>%filter(isSender==0)%>%group_by(simkey,wireless,wakeupfor)%
finalStats=finalStats%>%left_join(senderEnergy,by=c("simkey","wireless","wakeupfor"))
finalStats=finalStats%>%left_join(receiverEnergy,by=c("simkey","wireless","wakeupfor"))
# Uptime
senderUptime=data%>%filter(isSender!=0)%>%group_by(simkey,wireless,wakeupfor)%>%summarise(senderUptime=mean(totalUptime))
receiverUptime=data%>%filter(isSender==0)%>%group_by(simkey,wireless,wakeupfor)%>%summarise(receiverUptime=mean(totalUptime))
finalStats=finalStats%>%left_join(senderUptime,by=c("simkey","wireless","wakeupfor"))
finalStats=finalStats%>%left_join(receiverUptime,by=c("simkey","wireless","wakeupfor"))
# Add nSendFail to stats
sendFail=data%>%filter(node=="on0")%>%group_by(simkey,wireless,wakeupfor)%>%summarise(nSendFail=mean(nSendFail))
finalStats=finalStats%>%left_join(sendFail,by=c("simkey","wireless","wakeupfor"))

Binary file not shown.

Before

Width:  |  Height:  |  Size: 193 KiB

After

Width:  |  Height:  |  Size: 198 KiB

View file

@ -45,7 +45,7 @@ run-simulation () {
seed=0
simtime=86400 # One day
wakeupevery=3600
wakeupfor=180
wakeupfor=60
n_nodes=12
extended="false"
hint="false"
@ -53,8 +53,8 @@ poff=0
pon=0.4
prx=0.16
ptx=0.16
datasize=1000000 # 1MB
hintsize=4
datasize=1000000 # 1Mb
hintsize=4 # Integer
latency="0ms"
bitrate="100kbps"

File diff suppressed because it is too large Load diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 120 KiB

After

Width:  |  Height:  |  Size: 124 KiB

View file

@ -1,33 +1,33 @@
|simkey |wireless | wakeupfor| sd| energy|
|:---------------|:--------|---------:|-----------:|--------:|
|baseline |lora | 60| 0.7931147| 806.3720|
|extended |lora | 60| 333.1256180| 771.5027|
|hint |lora | 60| 119.4777088| 861.6799|
|hintandextended |lora | 60| 581.6629842| 880.9506|
|simkey |wireless | wakeupfor| sd| energy|
|:---------------|:--------|---------:|---------:|---------:|
|baseline |nbiot | 60| 1.48709| 1511.9475|
|extended |nbiot | 60| 135.57627| 656.0265|
|hint |nbiot | 60| 229.89379| 1610.9705|
|hintandextended |nbiot | 60| 246.99711| 707.8236|
|simkey |wireless | wakeupfor| sd| energy|
|:---------------|:--------|---------:|----------:|--------:|
|baseline |lora | 180| 7.967123| 2417.922|
|extended |lora | 180| 349.822411| 1956.805|
|hint |lora | 180| 258.790975| 2613.556|
|hintandextended |lora | 180| 391.659793| 1989.339|
|simkey |wireless | wakeupfor| sd| energy|
|:---------------|:--------|---------:|---------:|--------:|
|baseline |lora | 60| 11.42543| 582.4248|
|extended |lora | 60| 247.76639| 724.7427|
|hint |lora | 60| 141.15796| 656.7739|
|hintandextended |lora | 60| 247.76716| 724.7431|
|simkey |wireless | wakeupfor| sd| energy|
|:---------------|:--------|---------:|---------:|--------:|
|baseline |nbiot | 180| 1006.7430| 3480.039|
|extended |nbiot | 180| 193.8343| 1854.401|
|hint |nbiot | 180| 808.8104| 2953.799|
|hintandextended |nbiot | 180| 257.5741| 1886.575|
|baseline |nbiot | 60| 46.29838| 602.1441|
|extended |nbiot | 60| 101.21359| 636.9688|
|hint |nbiot | 60| 318.54242| 760.1508|
|hintandextended |nbiot | 60| 101.22569| 636.9761|
|simkey |wireless | wakeupfor| sd| energy|
|:---------------|:--------|---------:|--------:|--------:|
|baseline |lora | 180| 79.1002| 1776.200|
|extended |lora | 180| 295.1277| 1923.262|
|hint |lora | 180| 327.1633| 2025.394|
|hintandextended |lora | 180| 295.1290| 1923.263|
|simkey |wireless | wakeupfor| sd| energy|
|:---------------|:--------|---------:|--------:|--------:|
|baseline |nbiot | 180| 157.3624| 1827.347|
|extended |nbiot | 180| 142.5041| 1819.366|
|hint |nbiot | 180| 167.7236| 1866.050|
|hintandextended |nbiot | 180| 142.5110| 1819.371|

View file

@ -1,33 +1,33 @@
|simkey |wireless | wakeupfor| sd_success| success| totalUptime| senderEnergy| receiverEnergy| nSendFail|
|:---------------|:--------|---------:|----------:|-------:|-----------:|------------:|--------------:|---------:|
|baseline |lora | 60| 0.000000| 0.00| 1440.000| 806.400| 806.3695| 28.41|
|extended |lora | 60| 2.098966| 7.28| 1810.167| 1742.876| 683.1960| 16.62|
|hint |lora | 60| 0.000000| 0.00| 1535.000| 780.847| 869.0284| 24.98|
|hintandextended |lora | 60| 0.700000| 10.93| 1973.336| 2277.634| 753.9794| 2.46|
|simkey |wireless | wakeupfor| sd_success| success| senderEnergy| receiverEnergy| senderUptime| receiverUptime| nSendFail|
|:---------------|:--------|---------:|----------:|-------:|------------:|--------------:|------------:|--------------:|---------:|
|baseline |lora | 60| 0.000000| 0.00| 614.6688| 579.4935| 1440.000| 1439.945| 28.41|
|extended |lora | 60| 1.598105| 5.54| 1464.4720| 657.4945| 2952.060| 1579.271| 18.46|
|hint |lora | 60| 0.000000| 0.00| 778.7375| 645.6863| 1440.000| 1568.139| 27.99|
|hintandextended |lora | 60| 1.598105| 5.54| 1464.4747| 657.4948| 2952.067| 1579.272| 18.46|
|simkey |wireless | wakeupfor| sd_success| success| totalUptime| senderEnergy| receiverEnergy| nSendFail|
|:---------------|:--------|---------:|----------:|-------:|-----------:|------------:|--------------:|---------:|
|baseline |nbiot | 60| 0.000000| 0.00| 1440.000| 1512.000| 1511.9427| 28.41|
|extended |nbiot | 60| 2.079627| 7.28| 1490.220| 1050.007| 620.2101| 16.62|
|hint |nbiot | 60| 0.000000| 0.00| 1535.000| 1407.937| 1629.4282| 24.98|
|hintandextended |nbiot | 60| 0.700000| 10.93| 1533.444| 1237.278| 659.6914| 2.45|
|simkey |wireless | wakeupfor| sd_success| success| senderEnergy| receiverEnergy| senderUptime| receiverUptime| nSendFail|
|:---------------|:--------|---------:|----------:|-------:|------------:|--------------:|------------:|--------------:|---------:|
|baseline |nbiot | 60| 0.000000| 0.00| 732.9846| 590.2495| 1440.000| 1439.945| 28.41|
|extended |nbiot | 60| 1.591486| 5.55| 937.8329| 609.6175| 1622.902| 1458.437| 18.45|
|hint |nbiot | 60| 0.000000| 0.00| 1398.9990| 702.0737| 1440.000| 1568.139| 27.99|
|hintandextended |nbiot | 60| 1.591486| 5.55| 937.8766| 609.6215| 1623.011| 1458.446| 18.45|
|simkey |wireless | wakeupfor| sd_success| success| totalUptime| senderEnergy| receiverEnergy| nSendFail|
|:---------------|:--------|---------:|----------:|-------:|-----------:|------------:|--------------:|---------:|
|baseline |lora | 180| 0.0000000| 0.00| 4320.000| 2419.138| 2417.812| 37.05|
|extended |lora | 180| 0.1407053| 10.98| 4649.500| 3038.032| 1858.512| 5.15|
|hint |lora | 180| 0.1407053| 0.02| 4675.250| 2403.702| 2632.633| 27.22|
|hintandextended |lora | 180| 0.0000000| 11.00| 4749.086| 2917.942| 1904.920| 0.38|
|simkey |wireless | wakeupfor| sd_success| success| senderEnergy| receiverEnergy| senderUptime| receiverUptime| nSendFail|
|:---------------|:--------|---------:|----------:|-------:|------------:|--------------:|------------:|--------------:|---------:|
|baseline |lora | 180| 0.0000000| 0.00| 2022.634| 1753.797| 4319.890| 4317.521| 37.05|
|extended |lora | 180| 1.2535203| 9.38| 2817.306| 1860.257| 5897.747| 4517.161| 14.03|
|hint |lora | 180| 0.1407053| 0.02| 2397.703| 1991.548| 4319.890| 4826.655| 35.11|
|hintandextended |lora | 180| 1.2535203| 9.38| 2817.311| 1860.257| 5897.758| 4517.162| 14.03|
|simkey |wireless | wakeupfor| sd_success| success| totalUptime| senderEnergy| receiverEnergy| nSendFail|
|:---------------|:--------|---------:|----------:|-------:|-----------:|------------:|--------------:|---------:|
|baseline |nbiot | 180| 1.616956| 7.54| 4320.000| 4525.660| 3384.982| 27.93|
|extended |nbiot | 180| 0.000000| 11.00| 4343.043| 2437.980| 1801.348| 4.47|
|hint |nbiot | 180| 1.137248| 9.86| 4500.000| 2890.218| 2959.579| 23.77|
|hintandextended |nbiot | 180| 0.000000| 11.00| 4445.777| 2389.428| 1840.861| 0.68|
|simkey |wireless | wakeupfor| sd_success| success| senderEnergy| receiverEnergy| senderUptime| receiverUptime| nSendFail|
|:---------------|:--------|---------:|----------:|-------:|------------:|--------------:|------------:|--------------:|---------:|
|baseline |nbiot | 180| 1.616956| 7.54| 2326.829| 1783.422| 4319.887| 4317.528| 27.93|
|extended |nbiot | 180| 1.157147| 9.88| 2242.672| 1795.911| 4407.490| 4330.240| 19.33|
|hint |nbiot | 180| 1.151679| 9.87| 2332.049| 1840.230| 4319.825| 4398.176| 24.25|
|hintandextended |nbiot | 180| 1.157147| 9.88| 2242.694| 1795.915| 4407.546| 4330.248| 19.33|

View file

@ -15,6 +15,15 @@
#define MODE_ON() simgrid::s4u::this_actor::get_host()->set_pstate(1);
#define MODE_RX() simgrid::s4u::this_actor::get_host()->set_pstate(2);
#define MODE_TX() simgrid::s4u::this_actor::get_host()->set_pstate(3);
#define CLOCK (simgrid::s4u::Engine::get_clock())
#define TRACK_UPTIME(instruction) \
{ \
double uptimeTrack=CLOCK; \
instruction; \
uptimeTrack=CLOCK-uptimeTrack; \
uptime-=uptimeTrack; \
uptime=uptime > 0 ? uptime : 0; \
}
/// @brief Required by SimGrid
XBT_LOG_NEW_DEFAULT_CATEGORY(simulator, "[DAO]");
@ -27,12 +36,11 @@ typedef unsigned int u32;
*/
class Payload{
public:
Payload():hint(0),duration(0),containsHint(false),size(0){}
Payload():hint(0),duration(0),HasHint(false){}
double hint;
double duration;
int size;
bool containsHint;
std::string node;
bool HasHint;
std::string DedicatedMailbox;
};
/// @brief Observation node code
@ -82,15 +90,8 @@ static void obs_node(std::vector<std::string> args) {
simgrid::s4u::Mailbox *m = simgrid::s4u::Mailbox::by_name("medium");
XBT_INFO("Deploying observation node %s",selfName.c_str());
// Init convenient variables
bool isSender=i.is_sender;
bool useHint=i.use_hint;
bool isObserver=false;
u32 data_size=i.data_size;
// Starting node
bool hintReceived=false;
Payload *hint;
bool isObserver=false;
u32 nWakeUp=0;
u32 nDataRcv=0;
u32 nSendFail=0;
@ -98,6 +99,7 @@ static void obs_node(std::vector<std::string> args) {
u32 nSend=0;
double totalUptime=0;
while(i.ShouldContinue()){
// Start by sleeping
XBT_INFO("%s is spleeping",selfName.c_str());
MODE_OFF();
simgrid::s4u::this_actor::sleep_until(i.GetTS());
@ -106,113 +108,84 @@ static void obs_node(std::vector<std::string> args) {
// Doing wake up stuff
double uptime=i.GetDuration();
double startUptime=simgrid::s4u::Engine::get_clock();
while(uptime>0.00001){ // Ensure not infinite loop even if it should not happend (we loose accuracy here but just in case)
try {
if(isSender){ // If I am a sender
if(useHint&&i.HasNext()){
Payload *phint=new Payload();
phint->containsHint=true;
phint->hint=i.GetNextTS();
phint->duration=i.GetNextDuration();
phint->size=i.hint_size;
// Send data and update uptime
double hint_duration=simgrid::s4u::Engine::get_clock();
m->put(phint,phint->size,uptime);
hint_duration=simgrid::s4u::Engine::get_clock()-hint_duration;
hint_duration=hint_duration>0 ? hint_duration : 0; // Ensure valid hint_duration
uptime-=hint_duration;
uptime=uptime>0 ? uptime:0; // Ensure valid uptime
double upsince=simgrid::s4u::Engine::get_clock();
double upuntil=i.GetTS()+i.GetDuration();
while(uptime>0.0000001)
{
if(i.is_sender){
Payload *p=new Payload();
p->DedicatedMailbox="dedicated"+selfName;
if(i.use_hint && i.HasNext()){
p->HasHint=i.use_hint;
p->duration=i.GetNextDuration();
p->hint=i.GetNextTS();
}
MODE_ON();
try {
TRACK_UPTIME(m->put(p,0,uptime)); // Send instantaneous message
simgrid::s4u::Mailbox *m_ded= simgrid::s4u::Mailbox::by_name(p->DedicatedMailbox);
// First send hint if it is required
if(p->HasHint){
TRACK_UPTIME(m_ded->put(p,i.hint_size,uptime));
XBT_INFO("%s sent a hint successfully",selfName.c_str());
}
Payload *p=new Payload();
p->node=selfName;
p->size=data_size;
if(i.extended){
// We use a trick here
// First we send an instantaneous message (size=0) with the usual timeout
// to check whether there is a receiver!
// If there is one, we are sure that a put in the "medium"+selfName
// will not lead to a deadlock (cf anchor:5623) and we are using a exclusive
// channel (to avoid other receivers to get the message)
m->put(p,0,uptime);
simgrid::s4u::Mailbox *m_ext= simgrid::s4u::Mailbox::by_name("medium"+selfName);
MODE_TX();
m_ext->put(p,p->size);
}
else{
MODE_TX();
m->put(p,p->size,uptime);
}
nSend++;
isSender=(nSend<(i.n_nodes-1));
isObserver=!isSender;
// Then try sending the data
MODE_TX();
if(i.extended)
m_ded->put(p,i.data_size);
else
m_ded->put(p,i.data_size,uptime);
XBT_INFO("%s sent data successfully",selfName.c_str());
nSend++;
i.is_sender=(nSend<(i.n_nodes-1));
isObserver=!i.is_sender;
}
else if (!isObserver){
Payload* p;
if(i.extended){
// anchor:5623 We can see here that
// we first receive the instantaneous message
// and then we use a mailbox specific to the sender (to have an exclusive channel)
p=m->get<Payload>(uptime);
if(p->containsHint){
hintReceived=true;
hint=p;
XBT_INFO("%s received and hint of %f",selfName.c_str(),p->hint);
}
else {
simgrid::s4u::Mailbox *m_ext_sender = simgrid::s4u::Mailbox::by_name("medium"+p->node);
MODE_RX();
p=m_ext_sender->get<Payload>();
}
}
else{
MODE_RX();
p=m->get<Payload>(uptime);
nDataRcv++; // New data received
if(p->containsHint){
hintReceived=true;
hint=p;
XBT_INFO("%s received and hint of %f",selfName.c_str(),p->hint);
}
else{
isObserver=true; // Now we received the data we switch to observer
XBT_INFO("%s received data successfully",selfName.c_str());
}
}
}
else {
XBT_INFO("%s is observing his environment...",selfName.c_str());
MODE_ON();
simgrid::s4u::this_actor::sleep_for(uptime);
}
}
catch (...)
{
if(isSender){
catch(...){
XBT_INFO("%s could not send any data",selfName.c_str());
nSendFail++;
}
else{
XBT_INFO("%s could not receive any data",selfName.c_str());
if(hintReceived){
hintReceived=false;
i.AddEvent(hint->hint, hint->duration); // Schedule a new wake up time
}
nRcvFail++;
}
}
}
uptime=(i.GetTS()+i.GetDuration())-simgrid::s4u::Engine::get_clock();
else if(!isObserver){
Payload *p;
Payload *hint; // To Save the received hint
bool hintReceived=false;
MODE_ON();
try {
TRACK_UPTIME(p=m->get<Payload>(uptime)); // Get the instantaneous message
simgrid::s4u::Mailbox *m_ded= simgrid::s4u::Mailbox::by_name(p->DedicatedMailbox);
if(p->HasHint){
TRACK_UPTIME(p=m_ded->get<Payload>(uptime));
XBT_INFO("%s received a hint successfully",selfName.c_str());
hintReceived=true;
}
MODE_RX();
if(i.extended)
p=m_ded->get<Payload>(); // Fetch data
else
p=m_ded->get<Payload>(uptime); // Fetch data
XBT_INFO("%s received data successfully",selfName.c_str());
nDataRcv++;
isObserver=true;
i.is_sender=false;
}catch(...){
XBT_INFO("%s could not receive any data",selfName.c_str());
nRcvFail++;
if(hintReceived)
i.AddEvent(p->hint, p->duration); // Add the hint to the event list
}
}
else {
XBT_INFO("%s is observing his environment...",selfName.c_str());
MODE_ON();
simgrid::s4u::this_actor::sleep_for(uptime);
}
uptime=upuntil-CLOCK; // Note that uptime can be < 0 in extended mode
}
// Load next event
i.GotoNextEvent();
nWakeUp++; // Increase the number of wake up
totalUptime+=simgrid::s4u::Engine::get_clock()-startUptime;
if(hintReceived){
hintReceived=false;
i.AddEvent(hint->hint, hint->duration); // Schedule a new wake up time
}
totalUptime+=CLOCK-upsince;
}
// Done
MODE_OFF()