Task* createTask(int i, bool preemptable, float par) { Task* j = new Task(); // - set task's name stringstream jNameStr; jNameStr << "J_" << i; j->setName( jNameStr.str() ); // - set preemptability j->setPr(preemptable); // - set task's arrival time j->setA(0); // - set task's deadline // Task period int tp = 1 + rand() % 10; // Max # of repeating periods = maxR int maxR = L/tp; // floor of the division. not necessary due to dividing two ints. NOTE: we added the division by 2 in order to create tasks with greater freedom values (d-a-m). m:task length // # of repeating periods = R int R = 1 + rand() % maxR; //gives a number in [1,maxR] // Randomly deadline assigning if(L-tp*R == 0) j->setD( tp*R ); else { int maxFreedom = 5; // max. possible freedom. int freedom = min( rand()%(L - tp*R), maxFreedom); j->setD( freedom + tp*R ); //deadline = duration plus L-tp*R arasinda random bir sayi. } // - set task's load profile // average power of sinosoid: aS float aS = 0.5 + rand01(); float bS = (par-1)*aS; stringstream lNameStr; lNameStr << "L_" << i; Signal<double>* l = new Signal<double>(lNameStr.str(), tp*R, 0); for( int n=0; n<tp*R; n++) { // calculate value at n double val = aS + bS * sin (2 * M_PI * n / tp); l->setValueAt(n, val); } j->setL(l); return j; }
Signal<double>* createPMin() { // configuration for p_min duration = schedule lengt, # of period repeats = 1 int tp = L; int R = 1; double aS = 0.17; double bS = 0.02; Signal<double>* pMin = new Signal<double>("p_min", tp*R, 0); for( int n=0; n<tp*R; n++) { // calculate value at n double val = aS + bS * sin ((2 * M_PI * n / tp)+M_PI); pMin->setValueAt(n, val); } return pMin; }