Correct simulations

This commit is contained in:
Loic Guegan 2021-05-11 17:17:49 +02:00
parent 1477290330
commit fd4197731a
9 changed files with 16603 additions and 35769 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 192 KiB

After

Width:  |  Height:  |  Size: 193 KiB

View file

@ -15,7 +15,7 @@ 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 $hintsize > "$inputs"
$scenarios $seed $simtime $wakeupevery $wakeupfor $n_nodes $extended $hint $poff $pon $prx $ptx $datasize $bitrate $hintsize $latency > "$inputs"
# Init logs
[ $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}"
@ -55,11 +55,12 @@ prx=0.16
ptx=0.16
datasize=1000000 # 1MB
hintsize=4
latency="0ms"
bitrate="100kbps"
run-scenarios() {
# Configure number of seed per scenarios
nseed=200
nseed=100
# Baseline
echo "Baseline..."
@ -115,6 +116,7 @@ do
pon=0.4
prx=0.16
ptx=0.16
latency="0ms"
run-scenarios
# NbIot
@ -124,5 +126,6 @@ do
pon=0.4
prx=0.65
ptx=0.65
latency="10ms"
run-scenarios
done

File diff suppressed because it is too large Load diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 124 KiB

After

Width:  |  Height:  |  Size: 120 KiB

View file

@ -1,33 +1,33 @@
|simkey |wireless | wakeupfor| sd| energy|
|:---------------|:--------|---------:|----------:|--------:|
|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| 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 | 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 |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|
|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 |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|
|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|

View file

@ -1,33 +1,33 @@
|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|
|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| 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|
|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| 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|
|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| 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|
|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|

View file

@ -156,14 +156,14 @@ 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=\""<<d["bitrate"].GetString()<<"\" latency=\"0ms\" sharing_policy=\"SHARED\"></link>\n";
pf << " <link id=\"link\" bandwidth=\""<<d["bitrate"].GetString()<<"\" latency=\""<<d["latency"].GetString()<<"\" sharing_policy=\"SHARED\"></link>\n";
for (Value::ConstMemberIterator itr = d["nodes"].MemberBegin(); itr != d["nodes"].MemberEnd(); ++itr)
{
std::string name=itr->name.GetString();
double power_off=d["nodes"][itr->name.GetString()]["power_off"].GetDouble();
double power_on=d["nodes"][itr->name.GetString()]["power_on"].GetDouble();
double power_rx=d["nodes"][itr->name.GetString()]["power_rx"].GetDouble();
double power_tx=d["nodes"][itr->name.GetString()]["power_tx"].GetDouble();
double power_rx=power_on+d["nodes"][itr->name.GetString()]["power_rx"].GetDouble();
double power_tx=power_on+d["nodes"][itr->name.GetString()]["power_tx"].GetDouble();
// Create node
pf << " <host id=\""<<name<<"\" speed=\"100.0f,100.0f,100.0f,100.0f\" pstate=\"0\">\n";

View file

@ -17,10 +17,10 @@ using namespace rapidjson;
int main(int argc, char **argv){
// Setup seed
if(argc!=15){
if(argc!=16){
cerr << "Usage: " << argv[0] <<
" <seed> <simtime> <wakeupevery> <wakeupfor> <n_nodes>" <<
" <extended> <hint> <poff> <pon> <prx> <ptx> <datasize> <bitrate> <hintsize>" <<
" <extended> <hint> <poff> <pon> <prx> <ptx> <datasize> <bitrate> <hintsize> <latency>" <<
endl;
exit(1);
}
@ -40,6 +40,7 @@ int main(int argc, char **argv){
unsigned int datasize=atoi(argv[12]);
string bitrate(argv[13]);
unsigned int hintsize=atoi(argv[14]);
string latency(argv[15]);
// Setup seed
@ -49,9 +50,12 @@ int main(int argc, char **argv){
Document d;
d.SetObject();
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());
Value bitrateValue;
bitrateValue.SetString(bitrate.c_str(),bitrate.size(),d.GetAllocator());
d.AddMember("bitrate",bitrateValue,d.GetAllocator());
Value latencyValue;
latencyValue.SetString(latency.c_str(),latency.size(),d.GetAllocator());
d.AddMember("latency",latencyValue,d.GetAllocator());
d.AddMember("extended",extended,d.GetAllocator());
d.AddMember("hint_size",hintsize,d.GetAllocator());

View file

@ -89,6 +89,8 @@ static void obs_node(std::vector<std::string> args) {
u32 data_size=i.data_size;
// Starting node
bool hintReceived=false;
Payload *hint;
u32 nWakeUp=0;
u32 nDataRcv=0;
u32 nSendFail=0;
@ -108,15 +110,23 @@ static void obs_node(std::vector<std::string> args) {
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
}
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
// First we send an instantaneous message (size=0) with the usual timeout
@ -137,6 +147,7 @@ static void obs_node(std::vector<std::string> args) {
isSender=(nSend<(i.n_nodes-1));
isObserver=!isSender;
XBT_INFO("%s sent data successfully",selfName.c_str());
}
else if (!isObserver){
Payload* p;
@ -145,23 +156,31 @@ static void obs_node(std::vector<std::string> args) {
// 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);
simgrid::s4u::Mailbox *m_ext_sender = simgrid::s4u::Mailbox::by_name("medium"+p->node);
MODE_RX();
p=m_ext_sender->get<Payload>();
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());
}
}
nDataRcv++; // New data received
if(p->containsHint){
XBT_INFO("%s received and hint of %f",selfName.c_str(),p->hint);
i.AddEvent(p->hint, p->duration); // Schedule a new wake up time
}
else{
XBT_INFO("%s received data successfully",selfName.c_str());
}
isObserver=true; // Now we received the data we switch to observer
}
else {
XBT_INFO("%s is observing his environment...",selfName.c_str());
@ -177,6 +196,10 @@ static void obs_node(std::vector<std::string> args) {
}
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++;
}
}
@ -186,6 +209,10 @@ static void obs_node(std::vector<std::string> args) {
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
}
}
// Done
MODE_OFF()