This commit is contained in:
Loic Guegan 2021-05-21 11:05:34 +02:00
commit b3bd42cf60
5 changed files with 18815 additions and 18934 deletions

View file

@ -14,6 +14,10 @@ finalEnergy=data%>%group_by(simkey,wireless,wakeupfor)%>%summarize(wireless=firs
# Success
finalStats=data%>%filter(isSender!=0)%>%group_by(simkey,wireless,wakeupfor)%>%summarise(sd_success=sd(nSend),success=mean(nSend))
# Hint Added
#hintAdded=data%>%filter(isSender==0)%>%group_by(simkey,wireless,wakeupfor)%>%summarise(hint_added=mean(hint_added))
#finalStats=finalStats%>%left_join(hintAdded,by=c("simkey","wireless","wakeupfor"))
# 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))

File diff suppressed because it is too large Load diff

View file

@ -1,33 +1,33 @@
|simkey |wireless | wakeupfor| sd| energy|
|:---------------|:--------|---------:|-----------:|---------:|
|baseline |lora | 60| 7.069153| 581.6244|
|extended |lora | 60| 5121.863625| 3618.6843|
|hint |lora | 60| 80.469264| 638.0569|
|hintandextended |lora | 60| 4363.990545| 3035.4251|
|simkey |wireless | wakeupfor| sd| energy|
|:---------------|:--------|---------:|----------:|--------:|
|baseline |lora | 60| 16.20871| 585.2851|
|extended |lora | 60| 109.94211| 642.2070|
|hint |lora | 60| 43.05886| 585.6350|
|hintandextended |lora | 60| 2515.09999| 998.2392|
|simkey |wireless | wakeupfor| sd| energy|
|:---------------|:--------|---------:|----------:|---------:|
|baseline |nbiot | 60| 28.38168| 598.7582|
|extended |nbiot | 60| 9663.82085| 6192.0457|
|hint |nbiot | 60| 102.65535| 660.4632|
|hintandextended |nbiot | 60| 209.15857| 634.9603|
|simkey |wireless | wakeupfor| sd| energy|
|:---------------|:--------|---------:|----------:|--------:|
|baseline |lora | 180| 42.82688| 1783.037|
|extended |lora | 180| 3894.56500| 4976.255|
|hint |lora | 180| 115.94509| 1899.600|
|hintandextended |lora | 180| 1908.12484| 3064.590|
|baseline |nbiot | 60| 59.68490| 608.9268|
|extended |nbiot | 60| 57.68462| 607.3198|
|hint |nbiot | 60| 2443.87299| 965.7313|
|hintandextended |nbiot | 60| 3048.25713| 1273.7034|
|simkey |wireless | wakeupfor| sd| energy|
|:---------------|:--------|---------:|---------:|--------:|
|baseline |nbiot | 180| 141.6811| 1899.670|
|extended |nbiot | 180| 7612.2701| 7512.737|
|hint |nbiot | 180| 202.4829| 1972.868|
|hintandextended |nbiot | 180| 201.6532| 1938.547|
|baseline |lora | 180| 98.1097| 1792.244|
|extended |lora | 180| 116.7433| 1797.571|
|hint |lora | 180| 4645.6128| 3485.132|
|hintandextended |lora | 180| 4064.7439| 3574.090|
|simkey |wireless | wakeupfor| sd| energy|
|:---------------|:--------|---------:|---------:|--------:|
|baseline |nbiot | 180| 226.2301| 1830.006|
|extended |nbiot | 180| 196.1743| 1809.083|
|hint |nbiot | 180| 4005.7292| 3803.934|
|hintandextended |nbiot | 180| 3656.4500| 3569.778|

View file

@ -1,33 +1,33 @@
|simkey |wireless | wakeupfor| sd_success| success| senderEnergy| receiverEnergy| senderUptime| receiverUptime| nSendFail|
|:---------------|:--------|---------:|----------:|-------:|------------:|--------------:|------------:|--------------:|---------:|
|baseline |lora | 60| 0.0000000| 0.00| 582.4480| 581.5495| 1440.000| 1439.945| 24.76|
|extended |lora | 60| 1.6378108| 4.62| 903.3720| 3885.1526| 1962.750| 7343.283| 19.38|
|hint |lora | 60| 0.0000000| 0.00| 623.8270| 639.3505| 1440.000| 1541.151| 25.40|
|hintandextended |lora | 60| 0.4163332| 0.22| 635.5733| 3261.8263| 1499.103| 6208.472| 24.15|
|simkey |wireless | wakeupfor| sd_success| success| senderEnergy| receiverEnergy| senderUptime| receiverUptime| nSendFail|
|:---------------|:--------|---------:|----------:|--------:|------------:|--------------:|------------:|--------------:|---------:|
|baseline |nbiot | 60| 0.3379977| 0.130000| 601.8050| 598.4813| 1440.000| 1439.945| 24.66|
|extended |nbiot | 60| 1.6446731| 4.890000| 750.4207| 6726.5865| 1474.320| 7284.242| 22.27|
|hint |nbiot | 60| 1.8409332| 6.854167| 910.9654| 638.6804| 1440.000| 1492.287| 29.73|
|hintandextended |nbiot | 60| 1.8177249| 6.357143| 800.6855| 620.2224| 1480.645| 1469.025| 21.69|
|baseline |lora | 60| 0.000000| 0.00| 631.6656| 581.0687| 1440.00| 1439.945| 0|
|extended |lora | 60| 1.584776| 5.56| 969.6080| 612.4433| 2068.18| 1498.759| 0|
|hint |lora | 60| 0.000000| 0.00| 628.0144| 581.3061| 1440.00| 1443.307| 0|
|hintandextended |lora | 60| 1.844347| 5.82| 993.9211| 998.6402| 2076.32| 2459.463| 0|
|simkey |wireless | wakeupfor| sd_success| success| senderEnergy| receiverEnergy| senderUptime| receiverUptime| nSendFail|
|:---------------|:--------|---------:|----------:|-------:|------------:|--------------:|------------:|--------------:|---------:|
|baseline |lora | 180| 0.3265986| 0.12| 1852.154| 1776.754| 4319.890| 4317.521| 29.18|
|extended |lora | 180| 1.2257754| 8.75| 2123.377| 5258.998| 4721.430| 10593.078| 19.80|
|hint |lora | 180| 1.2884883| 3.58| 1865.837| 1902.669| 4319.890| 4552.952| 25.00|
|hintandextended |lora | 180| 1.4191689| 3.19| 1918.013| 3168.919| 4477.614| 6793.447| 23.98|
|baseline |nbiot | 60| 1.279638| 2.17| 784.3185| 592.9821| 1440.000| 1439.945| 0|
|extended |nbiot | 60| 1.643598| 5.84| 783.7103| 591.2844| 1480.464| 1443.693| 0|
|hint |nbiot | 60| 1.799972| 2.45| 810.3055| 981.2274| 1440.000| 2406.739| 0|
|hintandextended |nbiot | 60| 2.074472| 6.14| 865.7780| 1312.0423| 1465.718| 3225.193| 0|
|simkey |wireless | wakeupfor| sd_success| success| senderEnergy| receiverEnergy| senderUptime| receiverUptime| nSendFail|
|:---------------|:--------|---------:|----------:|--------:|------------:|--------------:|------------:|--------------:|---------:|
|baseline |nbiot | 180| 1.4318174| 3.480000| 2091.904| 1882.194| 4319.890| 4317.521| 25.30|
|extended |nbiot | 180| 1.1290024| 8.910000| 2389.254| 8022.029| 4339.471| 10243.119| 22.88|
|hint |nbiot | 180| 0.5773503| 9.666667| 2473.159| 1963.957| 4320.000| 4431.448| 16.11|
|hintandextended |nbiot | 180| 0.5757792| 9.625000| 2386.788| 1929.392| 4335.945| 4400.879| 15.18|
|simkey |wireless | wakeupfor| sd_success| success| senderEnergy| receiverEnergy| senderUptime| receiverUptime| nSendFail|
|:---------------|:--------|---------:|----------:|-------:|------------:|--------------:|------------:|--------------:|---------:|
|baseline |lora | 180| 1.2608719| 1.69| 2097.188| 1764.522| 4319.890| 4317.521| 0|
|extended |lora | 180| 1.2007994| 9.75| 2167.506| 1763.941| 4765.810| 4353.125| 0|
|hint |lora | 180| 3.0891796| 3.18| 2103.666| 3649.202| 4319.890| 9018.256| 0|
|hintandextended |lora | 180| 0.7447459| 10.53| 2204.091| 3699.433| 4487.517| 9122.242| 0|
|simkey |wireless | wakeupfor| sd_success| success| senderEnergy| receiverEnergy| senderUptime| receiverUptime| nSendFail|
|:---------------|:--------|---------:|----------:|-------:|------------:|--------------:|------------:|--------------:|---------:|
|baseline |nbiot | 180| 1.2758835| 9.22| 2552.287| 1764.344| 4319.890| 4317.521| 0|
|extended |nbiot | 180| 1.1415035| 9.90| 2446.900| 1751.100| 4341.132| 4319.236| 0|
|hint |nbiot | 180| 0.9428090| 10.40| 3260.203| 3853.726| 4319.890| 9173.079| 0|
|hintandextended |nbiot | 180| 0.6620293| 10.69| 3156.078| 3607.525| 4331.405| 8585.471| 0|

View file

@ -17,6 +17,7 @@
#define MODE_TX() simgrid::s4u::this_actor::get_host()->set_pstate(3);
#define CLOCK (simgrid::s4u::Engine::get_clock())
#define CNAME (selfName.c_str())
#define FOR(t) (t<uptime?t:uptime)
#define TRACK_UPTIME(instruction) \
{ \
double uptimeTrack=CLOCK; \
@ -64,12 +65,15 @@ bool *data_ready;
*/
class Payload{
public:
Payload():hint(0),duration(0),HasHint(false),HisForward(false){}
Payload(Payload &p):hint(p.hint),duration(p.duration),HasHint(p.HasHint),DedicatedMailbox(p.DedicatedMailbox),HisForward(p.HisForward){}
Payload():hint(0),duration(0),HasHint(false),HisForward(false),HasData(false),DataSize(0),Abort(false){}
Payload(Payload &p):hint(p.hint),duration(p.duration),HasHint(p.HasHint),DedicatedMailbox(p.DedicatedMailbox),HisForward(p.HisForward),HasData(p.HasData),DataSize(p.DataSize),Abort(p.Abort){}
double hint; // The timestamp that should be used by the receiver
double duration; // The duration that should be used by the receiver
bool HasHint;
bool HasData;
bool HisForward;
bool Abort;
u32 DataSize;
std::string DedicatedMailbox; // Dedicated mailbox used by the sender/receiver
};
@ -132,14 +136,16 @@ static void obs_node(std::vector<std::string> args) {
XBT_INFO("Deploying observation node %s",CNAME);
// Starting node
bool isObserver=false;
u32 nWakeUp=0;
u32 nDataRcv=0;
u32 nSendFail=0;
u32 nRcvFail=0;
u32 nSend=0;
u32 hint_added=0;
double totalUptime=0;
Payload *hint_forward=NULL;
Payload *hint_forward=NULL; // Contains the hint to forward
bool is_sender=i.is_sender; // This variable might change if all receiver have received the data
bool isObserver=false;
while(i.ShouldContinue()){
// Start by sleeping
XBT_INFO("%s is spleeping",CNAME);
@ -149,74 +155,93 @@ static void obs_node(std::vector<std::string> args) {
XBT_INFO("%s wakes up",CNAME);
// Doing wake up stuff
double uptime=i.GetDuration();
double upsince=simgrid::s4u::Engine::get_clock();
double upuntil=i.GetTS()+i.GetDuration();
bool forward_mode=false;
while(uptime>0.00001) // Avoid dead lock with uptime since we handle it manually
double uptime=i.GetDuration(); // Store the remaining wake up duration (updated during the node uptime)
double upsince=CLOCK; // Store the time at which the node woke up
double upuntil=i.GetTS()+i.GetDuration(); // Store the time at which the node should sleep
bool forward_mode=false; // Turned on and off every x seconds by the receiver (to switch between forward hint mode and receiving data mode)
bool forward_only=false; // When observer receive a hint it switch to forward only up to the next wake up time
bool sendhint_mode=false; // Turned on and off every x seconds by the sender (to switch between send hint and send data)
while(uptime>0)
{
if(i.is_sender){
Payload *p=new Payload();
p->DedicatedMailbox="dedicated"+selfName;
// Add hint informations to the payload
if(i.use_hint && i.HasNext()){
// ---------- SENDER ----------
if(is_sender){
// Send hint if send hint mode is enable
if(i.use_hint && sendhint_mode && i.HasNext()){
Payload *p=new Payload();
p->DedicatedMailbox="hintmailbox"+selfName; // Use a dedicated mailbox
p->HasHint=true;
p->duration=i.GetNextDuration();
p->hint=i.GetNextTS();
}
try {
// First we send and instantaneous message
// This allow first to detect if their is a receiver
// (to not cause deadlock for the extended mode) and second
// to inform the receiver if he should get a hint first
TRACK_UPTIME(m->put(p,0,uptime));
simgrid::s4u::Mailbox *m_ded= simgrid::s4u::Mailbox::by_name(p->DedicatedMailbox);
// First send hint if it is required
if(p->HasHint){
TRACK_UPTIME(SEND(m_ded->put(p,i.hint_size,uptime)));
p->DataSize=i.hint_size;
try {
TRACK_UPTIME(m->put(p,0,FOR(0.3))); // Init connection with a receiver
simgrid::s4u::Mailbox *m_ded= simgrid::s4u::Mailbox::by_name(p->DedicatedMailbox);
MODE_TX();
SEND(m_ded->put(p,p->DataSize,uptime)); // Send the actual hint
XBT_INFO("%s sent a hint successfully",CNAME);
}
if(is_data_rcv_ready()){
MODE_TX();
// Then try sending the data
if(i.extended){
SEND(m_ded->put(p,i.data_size));
}
else{
SEND(m_ded->put(p,i.data_size,uptime));
}
// If we reach here, data has been sent successfully
XBT_INFO("%s sent data successfully",CNAME);
nSend++;
i.is_sender=(nSend<(i.n_nodes-1));
isObserver=!i.is_sender;
catch(...){
}
}
catch(...){
XBT_INFO("%s could not send any data",CNAME);
nSendFail++;
// Send data if send hint mode is disable
else{
Payload *p=new Payload();
p->DedicatedMailbox="datamailbox"+selfName;
p->HasData=true;
p->HasHint=false;
p->DataSize=i.data_size;
// Add hint to the data if possible
if(i.use_hint && i.HasNext()){
p->HasHint=true;
p->duration=i.GetNextDuration();
p->hint=i.GetNextTS();
p->DataSize+=i.hint_size; // Don't forget!!
}
// Send the data
try {
TRACK_UPTIME(m->put(p,0,FOR(1)));
simgrid::s4u::Mailbox *m_ded= simgrid::s4u::Mailbox::by_name(p->DedicatedMailbox);
Payload *ack=m_ded->get<Payload>();
if(!ack->Abort){
MODE_TX();
if(i.extended){
SEND(m_ded->put(p,p->DataSize));
}
else{
SEND(m_ded->put(p,p->DataSize,uptime));
}
XBT_INFO("%s sent data successfully",CNAME);
nSend++;
is_sender=(nSend<(i.n_nodes-1)); // Stop sending if all nodes received
isObserver=!is_sender; // Switch to observer mode if all nodes received the data
}
else {
simgrid::s4u::this_actor::sleep_for(FOR(1));
}
}
catch(...){}
}
sendhint_mode=!sendhint_mode; // Switch back and forth between sending hint and data
}
// ---------- RECEIVER ----------
else if(!isObserver){
// Here we try to forward hint for 0.1 sec and try to receive data for 1 secs
double try_for=forward_mode ? 0.1 : 1;
// Then we ensure we do not exceed uptime
try_for=try_for>uptime ? uptime : try_for;
try_for=i.use_hint ? try_for : uptime; // Ensure use should use hint
// Forward hint mode
if(i.use_hint && forward_mode){
if(hint_forward!=NULL && CLOCK < hint_forward->hint){
FORWARD_HINT(try_for); // Try forward for 5 seconds then switch to received mode
if(forward_mode){
if(i.use_hint && hint_forward!=NULL && CLOCK < hint_forward->hint){
try {
FORWARD_HINT(FOR(0.3)); // Try forward for 5 seconds then switch to received mode
}
catch(...){}
}
}
else { // Receiving mode
Payload *p; // Received data
Payload *hint; // To Save the received hint
bool hintReceived=false; // In case of error during data rx this will be use to check if we could use the *hint Payload object
try {
// Get the instantaneous message
do {
TRACK_UPTIME(p=m->get<Payload>(try_for));
TRACK_UPTIME(p=m->get<Payload>(FOR(1)));
if(p->HisForward){
if(hint_forward==NULL || (hint_forward !=NULL && p->hint!=hint_forward->hint)){
simgrid::s4u::Mailbox *m_ded=simgrid::s4u::Mailbox::by_name(p->DedicatedMailbox);
@ -227,67 +252,83 @@ static void obs_node(std::vector<std::string> args) {
if(CLOCK < p->hint){
i.AddEvent(p->hint, p->duration);
hint_forward=new Payload(*p);
hint_added++;
}
}
}
} while(p->HisForward);
simgrid::s4u::Mailbox *m_ded= simgrid::s4u::Mailbox::by_name(p->DedicatedMailbox);
Payload *ack=new Payload();
ack->Abort=false;
m_ded->put(ack,0);
// Start receiving data
MODE_RX();
if(p->HasHint){
if(p->HasHint && !p->HasData){
TRACK_UPTIME(p=m_ded->get<Payload>(uptime));
XBT_INFO("%s received a hint successfully",CNAME);
hint=new Payload(*p); // Save hint
hint_forward=new Payload(*p); // Enable hint forwarding
hintReceived=true;
if(CLOCK < p->hint){
i.AddEvent(p->hint, p->duration);
hint_forward=new Payload(*p);
hint_added++;
}
}
else {
if(i.extended){
p=m_ded->get<Payload>(); // Fetch data until sended
}
else
p=m_ded->get<Payload>(uptime); // Fetch data until sended or uptime expire
// If we reach here, data has been received successfully
XBT_INFO("%s received data successfully",CNAME);
if(p->HasHint){
XBT_INFO("%s received a hint along with data successfully",CNAME);
hint_forward=new Payload(*p); // Enable hint forwarding
}
nDataRcv++;
isObserver=true;
is_sender=false;
}
data_ready[id]=true; // Say to the receiver that he can send
if(i.extended)
p=m_ded->get<Payload>(); // Fetch data until sended
else
p=m_ded->get<Payload>(uptime); // Fetch data until sended or uptime expire
// If we reach here, data has been received successfully
XBT_INFO("%s received data successfully",CNAME);
nDataRcv++;
isObserver=true;
i.is_sender=false;
}catch(...){
XBT_INFO("%s could not receive any data",CNAME);
nRcvFail++;
if(hintReceived)
i.AddEvent(hint->hint, hint->duration); // Add the hint to the event list
}
data_ready[id]=false;
}
forward_mode=!forward_mode; // Toggle mode (go back and forth between receiving and forwarding)
}
// ---------- OBSERVER ----------
else {
XBT_INFO("%s is observing his environment...",CNAME);
MODE_ON();
if(i.use_hint){
double try_for=forward_mode ? 1 : 1;
try_for=try_for>uptime ? uptime : try_for;
if(forward_mode && hint_forward!=NULL && CLOCK < hint_forward->hint){
FORWARD_HINT(try_for);
if((forward_mode|forward_only) && hint_forward!=NULL && CLOCK < hint_forward->hint){
FORWARD_HINT(FOR(1));
}
else {
Payload *p;
try {
do {
TRACK_UPTIME(p=m->get<Payload>(try_for));
} while(p->HisForward);
TRACK_UPTIME(p=m->get<Payload>(FOR(1)));
} while(p->HisForward); // Ignore forwarded hint
simgrid::s4u::Mailbox *m_ded= simgrid::s4u::Mailbox::by_name(p->DedicatedMailbox);
// Start receiving hint
// Start receiving hint from sender
MODE_RX();
if(p->HasHint){
if(p->HasData){
Payload *ack=new Payload();
ack->Abort=true;
m_ded->put(ack,0);
simgrid::s4u::this_actor::sleep_for(FOR(1));
}
else if(p->HasHint){
TRACK_UPTIME(p=m_ded->get<Payload>(uptime));
XBT_INFO("%s received a hint successfully",CNAME);
hint_forward=new Payload(*p); // Enable hint forwarding
forward_only=true;
}
else {
simgrid::s4u::this_actor::sleep_for(try_for);
simgrid::s4u::this_actor::sleep_for(FOR(1));
}
}
catch(...){
@ -309,5 +350,5 @@ static void obs_node(std::vector<std::string> args) {
}
// Done
MODE_OFF()
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)",CNAME,CNAME,i.is_sender,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|hint_added:%d)",CNAME,CNAME,i.is_sender,nSend,nWakeUp,nDataRcv,nSendFail,nRcvFail,totalUptime,i.seed,hint_added);
}