本文整理汇总了C++中Experiment::pausedDuration方法的典型用法代码示例。如果您正苦于以下问题:C++ Experiment::pausedDuration方法的具体用法?C++ Experiment::pausedDuration怎么用?C++ Experiment::pausedDuration使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Experiment
的用法示例。
在下文中一共展示了Experiment::pausedDuration方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: calculateEstimatedDuration
void ExperimentController::calculateEstimatedDuration()
{
Experiment experiment = this->experiment();
double duration = (boost::posix_time::microsec_clock::local_time() - experiment.startedAt()).total_milliseconds() - (experiment.pausedDuration() * 1000);
double previousTargetTemp = HeatBlockInstance::getInstance()->temperature();
do
{
Stage *stage = experiment.protocol()->currentStage();
std::time_t holdTime = stage->currentStep()->holdTime();
double temperature = stage->currentStep()->temperature();
if (stage->autoDelta() && stage->currentCycle() > stage->autoDeltaStartCycle())
{
holdTime += stage->currentStep()->deltaDuration() * (stage->currentCycle() - stage->autoDeltaStartCycle());
if (holdTime < 0)
holdTime = 0;
temperature += stage->currentStep()->deltaTemperature() * (stage->currentCycle() - stage->autoDeltaStartCycle());
if (temperature < HeatBlockInstance::getInstance()->minTargetTemperature())
temperature = HeatBlockInstance::getInstance()->minTargetTemperature();
else if (temperature > HeatBlockInstance::getInstance()->maxTargetTemperature())
temperature = HeatBlockInstance::getInstance()->maxTargetTemperature();
}
double rate = stage->currentRamp()->rate();
rate = rate > 0 && rate <= kDurationCalcHeatBlockRampSpeed ? rate : kDurationCalcHeatBlockRampSpeed;
if (previousTargetTemp < temperature)
duration += (((temperature - previousTargetTemp) / rate) + holdTime) * 1000;
else
duration += (((previousTargetTemp - temperature) / rate) + holdTime) * 1000;
previousTargetTemp = temperature;
}
while (experiment.protocol()->advanceNextStep());
{
Poco::RWLock::ScopedWriteLock lock(*_machineMutex);
_experiment.setEstimatedDuration(std::round(duration / 1000));
}
}