当前位置: 首页>>代码示例>>C++>>正文


C++ Signal::setValueAt方法代码示例

本文整理汇总了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;
}
开发者ID:derino,项目名称:schencon,代码行数:55,代码来源:ProblemCreatorMain.cpp

示例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;
}
开发者ID:derino,项目名称:schencon,代码行数:18,代码来源:ProblemCreatorMain.cpp


注:本文中的Signal::setValueAt方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。