From 51d0c256a349f147b41221ac82932371f2037341 Mon Sep 17 00:00:00 2001 From: Loic Guegan Date: Sun, 9 May 2021 11:07:16 +0200 Subject: [PATCH] Debug and add scenarios in paper --- results/paper.sh | 22 +-- results/results.csv | 442 ++++++++++++++++++++++++++++++++++++++++---- src/Inputs.cc | 1 + src/Inputs.hpp | 3 +- src/scenarios.cc | 10 +- src/simulator.cc | 135 +++++++------- 6 files changed, 492 insertions(+), 121 deletions(-) diff --git a/results/paper.sh b/results/paper.sh index f2f40af..331d4f6 100755 --- a/results/paper.sh +++ b/results/paper.sh @@ -8,29 +8,29 @@ inputs="${wai}/../inputs.json" simulator="make -C ${wai}/../ run" parser="${wai}/../parser.awk" results="${wai}/results.csv" -nseed=10 +nseed=20 run-simulation () { # Generate inputs - $scenarios $seed $simtime $maxstartupdelay $wakeupevery $wakeupfor $n_nodes $extended $hint $poff $pon $prx $ptx $datasize $simkey > "$inputs" + $scenarios $seed $simtime $wakeupsd $wakeupevery $wakeupfor $n_nodes $extended $hint $poff $pon $prx $ptx $datasize $simkey > "$inputs" # Run simulations [ -e "$results" ] && { $simulator 2>&1 | $parser | sed 1d >> "$results"; } || { $simulator 2>&1 | $parser > "$results"; } } # Default Parameters seed=0 -simtime=100 -maxstartupdelay=1 -wakeupevery=10 -wakeupfor=10 -n_nodes=1 +simtime=7200 +wakeupsd=180 +wakeupevery=600 +wakeupfor=180 +n_nodes=5 extended="false" hint="false" poff=0 -pon=1 -prx=1 -ptx=2 -datasize=1 +pon=0.4 +prx=0.16 +ptx=0.16 +datasize=1000000 simkey=0 # Baseline diff --git a/results/results.csv b/results/results.csv index dbfdd2a..622f051 100644 --- a/results/results.csv +++ b/results/results.csv @@ -1,41 +1,401 @@ -node,nWakeUp,nDataRcv,nSendFail,nRcvFail,simkey,seed,energy -on0,1,0,1,0,baseline,1,180.000000 -on0,1,0,1,0,baseline,2,180.000000 -on0,1,0,1,0,baseline,3,180.000000 -on0,1,0,1,0,baseline,4,180.000000 -on0,1,0,1,0,baseline,5,180.000000 -on0,1,0,1,0,baseline,6,180.000000 -on0,1,0,1,0,baseline,7,180.000000 -on0,1,0,1,0,baseline,8,180.000000 -on0,1,0,1,0,baseline,9,180.000000 -on0,1,0,1,0,baseline,10,180.000000 -on0,1,0,1,0,hint,1,180.000000 -on0,1,0,1,0,hint,2,180.000000 -on0,1,0,1,0,hint,3,180.000000 -on0,1,0,1,0,hint,4,180.000000 -on0,1,0,1,0,hint,5,180.000000 -on0,1,0,1,0,hint,6,180.000000 -on0,1,0,1,0,hint,7,180.000000 -on0,1,0,1,0,hint,8,180.000000 -on0,1,0,1,0,hint,9,180.000000 -on0,1,0,1,0,hint,10,180.000000 -on0,1,0,1,0,extended,1,90.000000 -on0,1,0,1,0,extended,2,90.000000 -on0,1,0,1,0,extended,3,90.000000 -on0,1,0,1,0,extended,4,90.000000 -on0,1,0,1,0,extended,5,90.000000 -on0,1,0,1,0,extended,6,90.000000 -on0,1,0,1,0,extended,7,90.000000 -on0,1,0,1,0,extended,8,90.000000 -on0,1,0,1,0,extended,9,90.000000 -on0,1,0,1,0,extended,10,90.000000 -on0,1,0,1,0,hintandextended,1,90.000000 -on0,1,0,1,0,hintandextended,2,90.000000 -on0,1,0,1,0,hintandextended,3,90.000000 -on0,1,0,1,0,hintandextended,4,90.000000 -on0,1,0,1,0,hintandextended,5,90.000000 -on0,1,0,1,0,hintandextended,6,90.000000 -on0,1,0,1,0,hintandextended,7,90.000000 -on0,1,0,1,0,hintandextended,8,90.000000 -on0,1,0,1,0,hintandextended,9,90.000000 -on0,1,0,1,0,hintandextended,10,90.000000 +node,nSend,nWakeUp,nDataRcv,nSendFail,nRcvFail,simkey,seed,energy +on4,0,12,1,0,0,baseline,1,848.640000 +on2,0,12,1,0,0,baseline,1,856.320000 +on1,0,13,1,0,0,baseline,1,932.160000 +on0,4,12,0,0,0,baseline,1,848.640000 +on3,0,12,1,0,0,baseline,1,852.480000 +on0,4,12,0,0,0,baseline,2,848.640000 +on1,0,11,1,0,0,baseline,2,788.160000 +on4,0,13,1,0,0,baseline,2,920.640000 +on2,0,13,1,0,0,baseline,2,928.320000 +on3,0,13,1,0,0,baseline,2,924.480000 +on3,0,11,1,0,0,baseline,3,780.480000 +on4,0,12,1,0,0,baseline,3,848.640000 +on1,0,12,1,0,0,baseline,3,860.160000 +on0,4,13,0,0,0,baseline,3,920.640000 +on2,0,12,1,0,0,baseline,3,856.320000 +on2,0,11,1,0,0,baseline,4,784.320000 +on1,0,12,1,0,0,baseline,4,860.160000 +on0,4,12,0,0,0,baseline,4,848.640000 +on4,0,13,1,0,0,baseline,4,920.640000 +on3,0,13,1,0,0,baseline,4,924.480000 +on3,0,12,1,0,0,baseline,5,852.480000 +on0,4,12,0,0,0,baseline,5,848.640000 +on2,0,11,1,0,0,baseline,5,784.320000 +on4,0,12,1,0,0,baseline,5,848.640000 +on1,0,13,1,0,0,baseline,5,932.160000 +on1,0,12,1,0,0,baseline,6,860.160000 +on2,0,12,1,0,0,baseline,6,856.320000 +on0,4,12,0,0,0,baseline,6,848.640000 +on3,0,13,1,0,0,baseline,6,924.480000 +on4,0,13,1,0,0,baseline,6,920.640000 +on3,0,13,1,0,0,baseline,7,924.480000 +on0,4,13,0,0,0,baseline,7,920.640000 +on1,0,12,1,0,0,baseline,7,860.160000 +on2,0,13,1,0,0,baseline,7,928.320000 +on4,0,14,1,0,0,baseline,7,992.640000 +on1,0,13,1,0,0,baseline,8,932.160000 +on2,0,12,1,0,0,baseline,8,856.320000 +on4,0,12,1,0,0,baseline,8,848.640000 +on0,4,12,0,0,0,baseline,8,848.640000 +on3,0,12,1,0,0,baseline,8,852.480000 +on1,0,12,1,0,0,baseline,9,860.160000 +on3,0,12,1,0,0,baseline,9,852.480000 +on0,4,12,0,0,0,baseline,9,848.640000 +on4,0,12,1,0,0,baseline,9,848.640000 +on2,0,13,1,0,0,baseline,9,928.320000 +on4,0,12,1,0,0,baseline,10,848.640000 +on2,0,12,1,0,0,baseline,10,856.320000 +on0,4,12,0,0,0,baseline,10,848.640000 +on1,0,12,1,0,0,baseline,10,860.160000 +on3,0,12,1,0,0,baseline,10,852.480000 +on2,0,12,1,0,0,baseline,11,856.320000 +on1,0,12,1,0,0,baseline,11,860.160000 +on4,0,14,1,0,0,baseline,11,992.640000 +on3,0,12,1,0,0,baseline,11,852.480000 +on0,4,12,0,0,0,baseline,11,848.640000 +on3,0,11,1,0,0,baseline,12,780.480000 +on2,0,11,1,0,0,baseline,12,784.320000 +on1,0,12,1,0,0,baseline,12,860.160000 +on0,4,12,0,0,0,baseline,12,848.640000 +on4,0,13,1,0,0,baseline,12,920.640000 +on1,0,11,1,0,0,baseline,13,788.160000 +on2,0,12,1,0,0,baseline,13,856.320000 +on3,0,12,1,0,0,baseline,13,852.480000 +on0,4,13,0,0,0,baseline,13,920.640000 +on4,0,12,1,0,0,baseline,13,848.640000 +on0,4,11,0,0,0,baseline,14,776.640000 +on2,0,11,1,0,0,baseline,14,784.320000 +on1,0,13,1,0,0,baseline,14,932.160000 +on3,0,13,1,0,0,baseline,14,924.480000 +on4,0,12,1,0,0,baseline,14,848.640000 +on4,0,12,1,0,0,baseline,15,848.640000 +on3,0,11,1,0,0,baseline,15,780.480000 +on2,0,12,1,0,0,baseline,15,856.320000 +on1,0,13,1,0,0,baseline,15,932.160000 +on0,4,13,0,0,0,baseline,15,920.640000 +on2,0,14,1,0,0,baseline,16,1000.320000 +on4,0,12,1,0,0,baseline,16,848.640000 +on0,4,13,0,0,0,baseline,16,920.640000 +on1,0,12,1,0,0,baseline,16,860.160000 +on3,0,12,1,0,0,baseline,16,852.480000 +on4,0,11,1,0,0,baseline,17,776.640000 +on1,0,13,1,0,0,baseline,17,932.160000 +on2,0,11,1,0,0,baseline,17,784.320000 +on0,4,12,0,0,0,baseline,17,848.640000 +on3,0,13,1,0,0,baseline,17,924.480000 +on1,0,11,1,0,0,baseline,18,788.160000 +on2,0,12,1,0,0,baseline,18,856.320000 +on3,0,12,1,0,0,baseline,18,852.480000 +on0,4,13,0,0,0,baseline,18,920.640000 +on4,0,12,1,0,0,baseline,18,848.640000 +on4,0,12,1,0,0,baseline,19,848.640000 +on3,0,13,1,0,0,baseline,19,924.480000 +on0,4,12,0,0,0,baseline,19,848.640000 +on2,0,12,1,0,0,baseline,19,856.320000 +on1,0,12,1,0,0,baseline,19,860.160000 +on0,4,12,0,0,0,baseline,20,848.640000 +on2,0,12,1,0,0,baseline,20,856.320000 +on1,0,13,1,0,0,baseline,20,932.160000 +on4,0,12,1,0,0,baseline,20,848.640000 +on3,0,13,1,0,0,baseline,20,924.480000 +on4,0,12,1,0,0,hint,1,876.240000 +on2,0,12,1,0,0,hint,1,905.520000 +on1,0,13,1,0,0,hint,1,955.360000 +on0,4,12,0,0,0,hint,1,848.640000 +on3,0,12,1,0,0,hint,1,880.480000 +on0,4,12,0,0,0,hint,2,848.640000 +on1,0,11,1,0,0,hint,2,796.160000 +on4,0,13,1,0,0,hint,2,985.040000 +on2,0,14,1,0,0,hint,2,1000.320000 +on3,0,14,1,0,0,hint,2,996.480000 +on3,0,11,1,0,0,hint,3,837.280000 +on4,0,13,1,0,0,hint,3,920.640000 +on1,0,13,1,0,0,hint,3,932.160000 +on0,4,13,0,0,0,hint,3,920.640000 +on2,0,12,1,0,0,hint,3,863.920000 +on2,0,11,1,0,0,hint,4,831.120000 +on1,0,12,1,0,0,hint,4,865.760000 +on0,4,12,0,0,0,hint,4,848.640000 +on4,0,13,1,0,0,hint,4,953.040000 +on3,0,13,1,0,0,hint,4,945.280000 +on3,0,12,1,0,0,hint,5,882.080000 +on0,4,12,0,0,0,hint,5,848.640000 +on2,0,11,1,0,0,hint,5,794.720000 +on4,0,12,1,0,0,hint,5,889.040000 +on1,0,13,1,0,0,hint,5,964.160000 +on1,0,12,1,0,0,hint,6,930.560000 +on2,0,12,1,0,0,hint,6,858.720000 +on0,4,12,0,0,0,hint,6,848.640000 +on3,0,13,1,0,0,hint,6,972.480000 +on4,0,13,1,0,0,hint,6,933.440000 +on3,0,13,1,0,0,hint,7,995.680000 +on0,4,13,0,0,0,hint,7,920.640000 +on1,0,12,1,0,0,hint,7,901.760000 +on2,0,14,1,0,0,hint,7,1000.320000 +on4,0,14,1,0,0,hint,7,1015.040000 +on1,0,13,1,0,0,hint,8,950.960000 +on2,0,12,1,0,0,hint,8,892.720000 +on4,0,12,1,0,0,hint,8,895.440000 +on0,4,12,0,0,0,hint,8,848.640000 +on3,0,12,1,0,0,hint,8,881.280000 +on1,0,12,1,0,0,hint,9,862.560000 +on3,0,12,1,0,0,hint,9,902.480000 +on0,4,12,0,0,0,hint,9,848.640000 +on4,0,12,1,0,0,hint,9,908.240000 +on2,0,13,1,0,0,hint,9,931.520000 +on4,0,13,1,0,0,hint,10,920.640000 +on2,0,12,1,0,0,hint,10,889.520000 +on0,4,12,0,0,0,hint,10,848.640000 +on1,0,13,1,0,0,hint,10,932.160000 +on3,0,12,1,0,0,hint,10,859.280000 +on2,0,12,1,0,0,hint,11,861.120000 +on1,0,12,1,0,0,hint,11,903.360000 +on4,0,14,1,0,0,hint,11,1055.840000 +on3,0,13,1,0,0,hint,11,924.480000 +on0,4,12,0,0,0,hint,11,848.640000 +on3,0,11,1,0,0,hint,12,832.480000 +on2,0,11,1,0,0,hint,12,787.920000 +on1,0,12,1,0,0,hint,12,871.760000 +on0,4,12,0,0,0,hint,12,848.640000 +on4,0,13,1,0,0,hint,12,945.840000 +on1,0,11,1,0,0,hint,13,833.360000 +on2,0,12,1,0,0,hint,13,875.920000 +on3,0,13,1,0,0,hint,13,924.480000 +on0,4,13,0,0,0,hint,13,920.640000 +on4,0,12,1,0,0,hint,13,895.040000 +on0,4,11,0,0,0,hint,14,776.640000 +on2,0,11,1,0,0,hint,14,813.920000 +on1,0,13,1,0,0,hint,14,936.160000 +on3,0,13,1,0,0,hint,14,987.680000 +on4,0,12,1,0,0,hint,14,854.640000 +on4,0,12,1,0,0,hint,15,879.440000 +on3,0,11,1,0,0,hint,15,818.480000 +on2,0,12,1,0,0,hint,15,901.120000 +on1,0,13,1,0,0,hint,15,995.760000 +on0,4,13,0,0,0,hint,15,920.640000 +on2,0,14,1,0,0,hint,16,1051.920000 +on4,0,12,1,0,0,hint,16,881.840000 +on0,4,13,0,0,0,hint,16,920.640000 +on1,0,12,1,0,0,hint,16,904.160000 +on3,0,12,1,0,0,hint,16,899.280000 +on4,0,11,1,0,0,hint,17,782.240000 +on1,0,13,1,0,0,hint,17,989.360000 +on2,0,11,1,0,0,hint,17,829.120000 +on0,4,12,0,0,0,hint,17,848.640000 +on3,0,13,1,0,0,hint,17,968.080000 +on1,0,12,1,0,0,hint,18,860.160000 +on2,0,13,1,0,0,hint,18,928.320000 +on3,0,12,1,0,0,hint,18,865.280000 +on0,4,13,0,0,0,hint,18,920.640000 +on4,0,13,1,0,0,hint,18,920.640000 +on4,0,12,1,0,0,hint,19,890.240000 +on3,0,13,1,0,0,hint,19,987.280000 +on0,4,12,0,0,0,hint,19,848.640000 +on2,0,12,1,0,0,hint,19,865.520000 +on1,0,12,1,0,0,hint,19,884.160000 +on0,4,12,0,0,0,hint,20,848.640000 +on2,0,13,1,0,0,hint,20,928.320000 +on1,0,13,1,0,0,hint,20,962.560000 +on4,0,12,1,0,0,hint,20,887.840000 +on3,0,13,1,0,0,hint,20,936.080000 +on4,0,12,1,0,0,extended,1,860.160000 +on2,0,12,1,0,0,extended,1,860.160000 +on1,0,13,1,0,0,extended,1,932.160000 +on0,4,12,0,0,0,extended,1,848.640000 +on3,0,12,1,0,0,extended,1,860.160000 +on0,4,12,0,0,0,extended,2,848.640000 +on1,0,11,1,0,0,extended,2,788.160000 +on4,0,13,1,0,0,extended,2,932.160000 +on2,0,13,1,0,0,extended,2,932.160000 +on3,0,13,1,0,0,extended,2,932.160000 +on3,0,11,1,0,0,extended,3,788.160000 +on4,0,12,1,0,0,extended,3,860.160000 +on1,0,12,1,0,0,extended,3,860.160000 +on0,4,13,0,0,0,extended,3,920.640000 +on2,0,12,1,0,0,extended,3,860.160000 +on2,0,11,1,0,0,extended,4,788.160000 +on1,0,12,1,0,0,extended,4,860.160000 +on0,4,12,0,0,0,extended,4,848.640000 +on4,0,13,1,0,0,extended,4,932.160000 +on3,0,13,1,0,0,extended,4,932.160000 +on3,0,12,1,0,0,extended,5,860.160000 +on0,4,12,0,0,0,extended,5,848.640000 +on2,0,11,1,0,0,extended,5,788.160000 +on4,0,12,1,0,0,extended,5,860.160000 +on1,0,13,1,0,0,extended,5,932.160000 +on1,0,12,1,0,0,extended,6,860.160000 +on2,0,12,1,0,0,extended,6,860.160000 +on0,4,12,0,0,0,extended,6,848.640000 +on3,0,13,1,0,0,extended,6,932.160000 +on4,0,13,1,0,0,extended,6,932.160000 +on3,0,13,1,0,0,extended,7,932.160000 +on0,4,13,0,0,0,extended,7,920.640000 +on1,0,12,1,0,0,extended,7,860.160000 +on2,0,13,1,0,0,extended,7,932.160000 +on4,0,14,1,0,0,extended,7,1004.160000 +on1,0,13,1,0,0,extended,8,932.160000 +on2,0,12,1,0,0,extended,8,860.160000 +on4,0,12,1,0,0,extended,8,860.160000 +on0,4,12,0,0,0,extended,8,848.640000 +on3,0,12,1,0,0,extended,8,860.160000 +on1,0,12,1,0,0,extended,9,860.160000 +on3,0,12,1,0,0,extended,9,860.160000 +on0,4,12,0,0,0,extended,9,848.640000 +on4,0,12,1,0,0,extended,9,860.160000 +on2,0,13,1,0,0,extended,9,932.160000 +on4,0,12,1,0,0,extended,10,860.160000 +on2,0,12,1,0,0,extended,10,860.160000 +on0,4,12,0,0,0,extended,10,848.640000 +on1,0,12,1,0,0,extended,10,860.160000 +on3,0,12,1,0,0,extended,10,860.160000 +on2,0,12,1,0,0,extended,11,860.160000 +on1,0,12,1,0,0,extended,11,860.160000 +on4,0,14,1,0,0,extended,11,1004.160000 +on3,0,12,1,0,0,extended,11,860.160000 +on0,4,12,0,0,0,extended,11,848.640000 +on3,0,11,1,0,0,extended,12,788.160000 +on2,0,11,1,0,0,extended,12,788.160000 +on1,0,12,1,0,0,extended,12,860.160000 +on0,4,12,0,0,0,extended,12,848.640000 +on4,0,13,1,0,0,extended,12,932.160000 +on1,0,11,1,0,0,extended,13,788.160000 +on2,0,12,1,0,0,extended,13,860.160000 +on3,0,12,1,0,0,extended,13,860.160000 +on0,4,13,0,0,0,extended,13,920.640000 +on4,0,12,1,0,0,extended,13,860.160000 +on0,4,11,0,0,0,extended,14,776.640000 +on2,0,11,1,0,0,extended,14,788.160000 +on1,0,13,1,0,0,extended,14,932.160000 +on3,0,13,1,0,0,extended,14,932.160000 +on4,0,12,1,0,0,extended,14,860.160000 +on4,0,12,1,0,0,extended,15,860.160000 +on3,0,11,1,0,0,extended,15,788.160000 +on2,0,12,1,0,0,extended,15,860.160000 +on1,0,13,1,0,0,extended,15,932.160000 +on0,4,13,0,0,0,extended,15,920.640000 +on2,0,14,1,0,0,extended,16,1004.160000 +on4,0,12,1,0,0,extended,16,860.160000 +on0,4,13,0,0,0,extended,16,920.640000 +on1,0,12,1,0,0,extended,16,860.160000 +on3,0,12,1,0,0,extended,16,860.160000 +on4,0,11,1,0,0,extended,17,788.160000 +on1,0,13,1,0,0,extended,17,932.160000 +on2,0,11,1,0,0,extended,17,788.160000 +on0,4,12,0,0,0,extended,17,848.640000 +on3,0,13,1,0,0,extended,17,932.160000 +on1,0,11,1,0,0,extended,18,788.160000 +on2,0,12,1,0,0,extended,18,860.160000 +on3,0,12,1,0,0,extended,18,860.160000 +on0,4,13,0,0,0,extended,18,920.640000 +on4,0,12,1,0,0,extended,18,860.160000 +on4,0,12,1,0,0,extended,19,860.160000 +on3,0,13,1,0,0,extended,19,932.160000 +on0,4,12,0,0,0,extended,19,848.640000 +on2,0,12,1,0,0,extended,19,860.160000 +on1,0,12,1,0,0,extended,19,860.160000 +on0,4,12,0,0,0,extended,20,848.640000 +on2,0,12,1,0,0,extended,20,860.160000 +on1,0,13,1,0,0,extended,20,932.160000 +on4,0,12,1,0,0,extended,20,860.160000 +on3,0,13,1,0,0,extended,20,932.160000 +on4,0,12,1,0,0,hintandextended,1,887.760000 +on2,0,12,1,0,0,hintandextended,1,909.360000 +on1,0,13,1,0,0,hintandextended,1,955.360000 +on0,4,12,0,0,0,hintandextended,1,848.640000 +on3,0,12,1,0,0,hintandextended,1,888.160000 +on0,4,12,0,0,0,hintandextended,2,848.640000 +on1,0,11,1,0,0,hintandextended,2,796.160000 +on4,0,13,1,0,0,hintandextended,2,996.560000 +on2,0,14,1,0,0,hintandextended,2,1004.160000 +on3,0,14,1,0,0,hintandextended,2,1004.160000 +on3,0,11,1,0,0,hintandextended,3,844.960000 +on4,0,13,1,0,0,hintandextended,3,932.160000 +on1,0,13,1,0,0,hintandextended,3,932.160000 +on0,4,13,0,0,0,hintandextended,3,920.640000 +on2,0,12,1,0,0,hintandextended,3,867.760000 +on2,0,11,1,0,0,hintandextended,4,834.960000 +on1,0,12,1,0,0,hintandextended,4,865.760000 +on0,4,12,0,0,0,hintandextended,4,848.640000 +on4,0,13,1,0,0,hintandextended,4,964.560000 +on3,0,13,1,0,0,hintandextended,4,952.960000 +on3,0,12,1,0,0,hintandextended,5,889.760000 +on0,4,12,0,0,0,hintandextended,5,848.640000 +on2,0,11,1,0,0,hintandextended,5,798.560000 +on4,0,12,1,0,0,hintandextended,5,900.560000 +on1,0,13,1,0,0,hintandextended,5,964.160000 +on1,0,12,1,0,0,hintandextended,6,930.560000 +on2,0,12,1,0,0,hintandextended,6,862.560000 +on0,4,12,0,0,0,hintandextended,6,848.640000 +on3,0,13,1,0,0,hintandextended,6,980.160000 +on4,0,13,1,0,0,hintandextended,6,944.960000 +on3,0,13,1,0,0,hintandextended,7,1003.360000 +on0,4,13,0,0,0,hintandextended,7,920.640000 +on1,0,12,1,0,0,hintandextended,7,901.760000 +on2,0,14,1,0,0,hintandextended,7,1004.160000 +on4,0,14,1,0,0,hintandextended,7,1026.560000 +on1,0,13,1,0,0,hintandextended,8,950.960000 +on2,0,12,1,0,0,hintandextended,8,896.560000 +on4,0,12,1,0,0,hintandextended,8,906.960000 +on0,4,12,0,0,0,hintandextended,8,848.640000 +on3,0,12,1,0,0,hintandextended,8,888.960000 +on1,0,12,1,0,0,hintandextended,9,862.560000 +on3,0,12,1,0,0,hintandextended,9,910.160000 +on0,4,12,0,0,0,hintandextended,9,848.640000 +on4,0,12,1,0,0,hintandextended,9,919.760000 +on2,0,13,1,0,0,hintandextended,9,935.360000 +on4,0,13,1,0,0,hintandextended,10,932.160000 +on2,0,12,1,0,0,hintandextended,10,893.360000 +on0,4,12,0,0,0,hintandextended,10,848.640000 +on1,0,13,1,0,0,hintandextended,10,932.160000 +on3,0,12,1,0,0,hintandextended,10,866.960000 +on2,0,12,1,0,0,hintandextended,11,864.960000 +on1,0,12,1,0,0,hintandextended,11,903.360000 +on4,0,14,1,0,0,hintandextended,11,1067.360000 +on3,0,13,1,0,0,hintandextended,11,932.160000 +on0,4,12,0,0,0,hintandextended,11,848.640000 +on3,0,11,1,0,0,hintandextended,12,840.160000 +on2,0,11,1,0,0,hintandextended,12,791.760000 +on1,0,12,1,0,0,hintandextended,12,871.760000 +on0,4,12,0,0,0,hintandextended,12,848.640000 +on4,0,13,1,0,0,hintandextended,12,957.360000 +on1,0,11,1,0,0,hintandextended,13,833.360000 +on2,0,12,1,0,0,hintandextended,13,879.760000 +on3,0,13,1,0,0,hintandextended,13,932.160000 +on0,4,13,0,0,0,hintandextended,13,920.640000 +on4,0,12,1,0,0,hintandextended,13,906.560000 +on0,4,11,0,0,0,hintandextended,14,776.640000 +on2,0,11,1,0,0,hintandextended,14,817.760000 +on1,0,13,1,0,0,hintandextended,14,936.160000 +on3,0,13,1,0,0,hintandextended,14,995.360000 +on4,0,12,1,0,0,hintandextended,14,866.160000 +on4,0,12,1,0,0,hintandextended,15,890.960000 +on3,0,11,1,0,0,hintandextended,15,826.160000 +on2,0,12,1,0,0,hintandextended,15,904.960000 +on1,0,13,1,0,0,hintandextended,15,995.760000 +on0,4,13,0,0,0,hintandextended,15,920.640000 +on2,0,14,1,0,0,hintandextended,16,1055.760000 +on4,0,12,1,0,0,hintandextended,16,893.360000 +on0,4,13,0,0,0,hintandextended,16,920.640000 +on1,0,12,1,0,0,hintandextended,16,904.160000 +on3,0,12,1,0,0,hintandextended,16,906.960000 +on4,0,11,1,0,0,hintandextended,17,793.760000 +on1,0,13,1,0,0,hintandextended,17,989.360000 +on2,0,11,1,0,0,hintandextended,17,832.960000 +on0,4,12,0,0,0,hintandextended,17,848.640000 +on3,0,13,1,0,0,hintandextended,17,975.760000 +on1,0,12,1,0,0,hintandextended,18,860.160000 +on2,0,13,1,0,0,hintandextended,18,932.160000 +on3,0,12,1,0,0,hintandextended,18,872.960000 +on0,4,13,0,0,0,hintandextended,18,920.640000 +on4,0,13,1,0,0,hintandextended,18,932.160000 +on4,0,12,1,0,0,hintandextended,19,901.760000 +on3,0,13,1,0,0,hintandextended,19,994.960000 +on0,4,12,0,0,0,hintandextended,19,848.640000 +on2,0,12,1,0,0,hintandextended,19,869.360000 +on1,0,12,1,0,0,hintandextended,19,884.160000 +on0,4,12,0,0,0,hintandextended,20,848.640000 +on2,0,13,1,0,0,hintandextended,20,932.160000 +on1,0,13,1,0,0,hintandextended,20,962.560000 +on4,0,12,1,0,0,hintandextended,20,899.360000 +on3,0,13,1,0,0,hintandextended,20,943.760000 diff --git a/src/Inputs.cc b/src/Inputs.cc index 4eeff77..cf91de4 100644 --- a/src/Inputs.cc +++ b/src/Inputs.cc @@ -19,6 +19,7 @@ Inputs::Inputs(std::string node_name){ extended=d["extended"].GetBool(); simkey=d["simkey"].GetString(); seed=d["seed"].GetInt(); + n_nodes=d["nodes"].MemberCount(); // Instantiate wake_ts for(auto& v:d["nodes"][node_name.c_str()]["wake_ts"].GetArray()){ diff --git a/src/Inputs.hpp b/src/Inputs.hpp index b0b4825..0bec0b5 100644 --- a/src/Inputs.hpp +++ b/src/Inputs.hpp @@ -41,7 +41,7 @@ public: /** * Is there another event to process ? */ - bool HasNext(){return(wake_ts.size()>1);} + bool HasNext(){return wake_ts.size()>1 ;} /** * Get current event timestamp */ @@ -78,6 +78,7 @@ public: bool extended; int data_size; int seed; + int n_nodes; std::string simkey; }; \ No newline at end of file diff --git a/src/scenarios.cc b/src/scenarios.cc index c2d1f5f..9395840 100644 --- a/src/scenarios.cc +++ b/src/scenarios.cc @@ -10,7 +10,7 @@ #include -#define RAND(min,max) (rand()%(max-min+1)+min) +#define RAND(min,max) (rand()%((max)-(min)+1)+(min)) using namespace std; using namespace rapidjson; @@ -19,7 +19,7 @@ int main(int argc, char **argv){ // Setup seed if(argc!=15){ cerr << "Usage: " << argv[0] << - " " << + " " << " " << endl; exit(1); @@ -28,8 +28,8 @@ int main(int argc, char **argv){ // Init parameters int seed=atoi(argv[1]); double simtime=stod(argv[2]); - unsigned int maxstartupdelay=atoi(argv[3]); - double wakeupevery=stod(argv[4]); + 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]); @@ -69,7 +69,7 @@ int main(int argc, char **argv){ // Setup ts and durations Value ts(kArrayType); Value duration(kArrayType); - for(unsigned int i=maxstartupdelay;(i+wakeupfor) args) { u32 nDataRcv=0; u32 nSendFail=0; u32 nRcvFail=0; + u32 nSend=0; while(i.ShouldContinue()){ XBT_INFO("%s is spleeping",selfName.c_str()); MODE_OFF(); @@ -100,73 +101,81 @@ static void obs_node(std::vector args) { XBT_INFO("%s wakes up",selfName.c_str()); // Doing wake up stuff - try { - if(isSender){ // If I am a sender - Payload *p=new Payload(); - p->node=selfName; - if(useHint&&i.HasNext()){ - p->containsHint=true; - p->hint=i.GetNextTS(); - p->duration=i.GetNextDuration(); + double uptime=i.GetDuration(); + 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 + Payload *p=new Payload(); + p->node=selfName; + if(useHint&&i.HasNext()){ + p->containsHint=true; + p->hint=i.GetNextTS(); + p->duration=i.GetNextDuration(); + } + 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,data_size); + } + else{ + MODE_TX(); + m->put(p,data_size,uptime); + } + nSend++; + isSender=(nSend<(i.n_nodes-1)); + isObserver=!isSender; + XBT_INFO("%s sent data successfully",selfName.c_str()); } - 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,i.GetDuration()); - simgrid::s4u::Mailbox *m_ext= simgrid::s4u::Mailbox::by_name("medium"+selfName); - MODE_TX(); - m_ext->put(p,data_size); + 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(uptime); + simgrid::s4u::Mailbox *m_ext_sender = simgrid::s4u::Mailbox::by_name("medium"+p->node); + MODE_RX(); + p=m_ext_sender->get(); + } + else{ + MODE_RX(); + p=m->get(uptime); + } + 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{ - MODE_TX(); - m->put(p,data_size,i.GetDuration()); + else { + XBT_INFO("%s is observing his environment...",selfName.c_str()); + MODE_ON(); + simgrid::s4u::this_actor::sleep_for(uptime); } - XBT_INFO("%s sent data successfully",selfName.c_str()); } - 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(i.GetDuration()); - simgrid::s4u::Mailbox *m_ext_sender = simgrid::s4u::Mailbox::by_name("medium"+p->node); - MODE_RX(); - p=m_ext_sender->get(); - } - else{ - MODE_RX(); - p=m->get(i.GetDuration()); - } - 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 and switch to forwarding mode",selfName.c_str()); - } - isObserver=true; // Now we received the data we switch to observer + catch (...) + { + if(isSender){ + XBT_INFO("%s could not send any data",selfName.c_str()); + nSendFail++; + } + else{ + XBT_INFO("%s could not receive any data",selfName.c_str()); + nRcvFail++; + } } - else { - XBT_INFO("%s is observing his environment...",selfName.c_str()); - simgrid::s4u::this_actor::sleep_until(i.GetDuration()); - } - } - catch (...) - { - if(isSender){ - XBT_INFO("%s could not send any data",selfName.c_str()); - nSendFail++; - } - else{ - XBT_INFO("%s could not receive any data",selfName.c_str()); - nRcvFail++; - } + uptime=(i.GetTS()+i.GetDuration())-simgrid::s4u::Engine::get_clock(); } // Load next event i.GotoNextEvent(); @@ -174,5 +183,5 @@ static void obs_node(std::vector args) { } // Done MODE_OFF() - XBT_INFO("Observation node %s finished [LOG2PARSE](node:%s|nWakeUp:%d|nDataRcv:%d|nSendFail:%d|nRcvFail:%d|simkey:%s|seed:%d)",selfName.c_str(),selfName.c_str(),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|simkey:%s|seed:%d)",selfName.c_str(),selfName.c_str(),nSend,nWakeUp,nDataRcv,nSendFail,nRcvFail,i.simkey.c_str(),i.seed); } \ No newline at end of file