aboutsummaryrefslogtreecommitdiff
path: root/src/scenarios.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/scenarios.cc')
-rw-r--r--src/scenarios.cc10
1 files changed, 5 insertions, 5 deletions
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 <sstream>
-#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] <<
- " <seed> <simtime> <maxstartupdelay> <wakeupevery> <wakeupfor> <n_nodes>" <<
+ " <seed> <simtime> <wakeupsd> <wakeupevery> <wakeupfor> <n_nodes>" <<
" <extended> <hint> <poff> <pon> <prx> <ptx> <datasize> <simkey>" <<
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)<simtime;i+=wakeupevery){
+ for(unsigned int i=0;(i+wakeupfor)<simtime;i+=RAND(wakeupevery-wakeupsd,wakeupevery+wakeupsd)){
ts.PushBack(Value().SetDouble(i),d.GetAllocator());
duration.PushBack(Value().SetDouble(wakeupfor),d.GetAllocator());
}