本文整理汇总了C++中Signal::setValueAt方法的典型用法代码示例。如果您正苦于以下问题:C++ Signal::setValueAt方法的具体用法?C++ Signal::setValueAt怎么用?C++ Signal::setValueAt使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Signal
的用法示例。
在下文中一共展示了Signal::setValueAt方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: createTask
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;
}
示例2: createPMin
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;
}