예제 #1
0
void AMLoopAction3::internalOnCurrentActionProgressChanged(double numerator, double denominator)
{
	if(internalAllActionsHaveExpectedDuration()) {
		double totalNumerator = 0, totalDenominator = 0;
		for(int i=0, cc=subActionCount(); i<cc; i++) {
			AMAction3* action = subActionAt(i);

			double expectedSecs = action->info()->expectedDuration();
			totalDenominator += expectedSecs*loopCount();
			int timesFinished = currentIteration_;
			if(i < currentSubActionIndex_)
				timesFinished++;
			totalNumerator += expectedSecs*timesFinished;

			if(i == currentSubActionIndex())	// if it's the current action, we have some partial progress.
				totalNumerator += numerator/denominator * expectedSecs;
		}
		setProgress(totalNumerator, totalDenominator);
		setExpectedDuration(totalDenominator);
	}
	// Otherwise, assume every subaction makes up an equal unit ('1') of the total amount of work. Our denominator will be the number of sub-actions * the number of loops, and our numerator will be the sub-actions we've completed (plus the current sub-action's fraction done).
	else {
		double totalDenominator = subActionCount()*loopCount();
		double totalNumerator = subActionCount()*currentIteration_;	// add the completed full loops
		totalNumerator += currentSubActionIndex_;	// add the actions done in this loop
		totalNumerator += numerator/denominator;	// add the fraction done for the current action.
		setProgress(totalNumerator, totalDenominator);
		setExpectedDuration(runningTime()*totalDenominator/totalNumerator);
	}
}
void VESPERSEXAFSScanConfiguration::computeTotalTimeImplementation()
{
	double time = 0;

	if (exafsRegions()->hasKSpace() && !useFixedTime_){

		for (int i = 0; i < regions_->count(); i++){

			if (exafsRegions()->type(i) == AMEXAFSRegion::kSpace)
				time += VESPERSBeamline::vespers()->variableIntegrationTime()->totalTime(regions_->delta(i)) + ((regions_->end(i) - regions_->start(i))/regions_->delta(i))*timeOffset_;

			else
				time += ((regions_->end(i) - regions_->start(i))/regions_->delta(i))*(regions_->time(i) + timeOffset_); // Seems to take about 0.7 seconds for extra beamline stuff to happen.
		}
	}

	else{

		for (int i = 0; i < regions_->count(); i++)
			time += ((regions_->end(i) - regions_->start(i))/regions_->delta(i))*(regions_->time(i) + timeOffset_); // Seems to take about 0.7 seconds for extra beamline stuff to happen.
	}

	totalTime_ = time + 9; // There is a 9 second miscellaneous startup delay.
	setExpectedDuration(totalTime_);
	emit totalTimeChanged(totalTime_);
}
예제 #3
0
AMScanConfiguration *AMScanActionInfo::configuration()
{
    if (config_)
        return config_;

    config_ = getConfigurationFromDb();
    connect(config_, SIGNAL(expectedDurationChanged(double)), this, SLOT(setExpectedDuration(double)));

    setExpectedDuration(config_->expectedDuration());
    return config_;
}
void SXRMB2DMapScanConfiguration::computeTotalTimeImplementation()
{
	double time = 0;

	// Get the number of points.
	time = scanAxisAt(0)->numberOfPoints() + scanAxisAt(1)->numberOfPoints();

	time *= double(scanAxisAt(0)->regionAt(0)->regionTime()) + timeOffset_;

	totalTime_ = time + 9; // initialization time is about 9s
	setExpectedDuration(totalTime_);
	emit totalTimeChanged(totalTime_);
}
예제 #5
0
AMScanActionInfo::AMScanActionInfo(AMScanConfiguration *config, const QString &iconFileName, QObject *parent)
    : AMActionInfo3(config->userScanName(), config->description(), iconFileName, parent)
{
    config_ = config;
    scanID_ = -1;

    connect(config_, SIGNAL(expectedDurationChanged(double)), this, SLOT(setExpectedDuration(double)));
    connect(config_, SIGNAL(configurationChanged()), this, SLOT(onConfigChanged()));
    setExpectedDuration(config_->expectedDuration());

    if(!config_->detailedDescription().isEmpty()) {
        setShortDescription(config_->userScanName()%"\n"%config_->description());
        setLongDescription(config_->detailedDescription());
    }
}
void VESPERSTimeScanConfiguration::computeTotalTimeImplementation()
{
	double totalTime = 0;

	// Factor in the time per point.  There is an extra 6 seconds for CCD images for the Roper and Mar.
	if (ccdDetector() == VESPERS::Roper)
		totalTime += timePerAcquisition() + timeOffset_ + 6.0;
	else if (ccdDetector() == VESPERS::Mar)
		totalTime += timePerAcquisition() + timeOffset_ + 3.0;
	else
		totalTime += timePerAcquisition() + timeOffset_;

	totalTime_ = iterations_*totalTime;
	setExpectedDuration(totalTime_);
	emit totalTimeChanged(totalTime_);
}
예제 #7
0
void AMControlMoveAction::onProgressTick()
{
	double destination = control_->setpoint();
	double fractionComplete = (control_->value() - startPosition_.value()) / (destination - startPosition_.value());
	double runningSeconds = runningTime();
	double expectedTotalSeconds = runningSeconds / fractionComplete;

	if(fractionComplete != 0) {
		// set expected duration based on time taken so far and distance travelled to destination.
		setExpectedDuration(expectedTotalSeconds);
		setProgress(runningSeconds, expectedTotalSeconds);	// exactly equal to fractionComplete. We observe the convention that when possible, progress numerator and denominator should be in seconds.
	}
	else {
		setProgress(0, 100);
		// in this case, no idea on the expected duration (unless we knew the speed of the control)
	}
}
예제 #8
0
AMScanActionInfo::AMScanActionInfo(const AMScanActionInfo &other)
    : AMActionInfo3(other)
{
    config_ = other.config_ ? other.config_->createCopy() : 0;
    scanID_ = -1;

    connect(config_, SIGNAL(expectedDurationChanged(double)), this, SLOT(setExpectedDuration(double)));
    connect(config_, SIGNAL(configurationChanged()), this, SLOT(onConfigChanged()));
    setExpectedDuration(config_->expectedDuration());

    if(!config_->detailedDescription().isEmpty()) {
        QString scanName = config_->userScanName();
        if(scanName.isEmpty())
            scanName = other.shortDescription();
        setShortDescription(scanName);
        setLongDescription(config_->detailedDescription());
    }
}
void VESPERS2DScanConfiguration::computeTotalTimeImplementation()
{
	double time = 0;

	// Get the number of points.
	time = 	scanAxisAt(0)->numberOfPoints() * scanAxisAt(1)->numberOfPoints();

	// Factor in the time per point.  There is an extra 6 seconds for CCD images for the Roper and Mar.
	if (ccdDetector() == VESPERS::Roper)
		time *= double(scanAxisAt(0)->regionAt(0)->regionTime()) + timeOffset_ + 6.0;
	else if (ccdDetector() == VESPERS::Mar)
		time *= double(scanAxisAt(0)->regionAt(0)->regionTime()) + timeOffset_ + 3.0;
	else
		time *= double(scanAxisAt(0)->regionAt(0)->regionTime()) + timeOffset_;

	totalTime_ = time + 9;
	setExpectedDuration(totalTime_);
	emit totalTimeChanged(totalTime_);
}
void VESPERSSpatialLineScanConfiguration::computeTotalTimeImplementation()
{
	double totalTime = 0;

	// Get the number of points.  Using 0 for the index because this will only have one region per scan.
	totalTime = scanAxisAt(0)->regionAt(0)->numberOfPoints();

	// Factor in the time per point.  There is an extra 6 seconds for CCD images for the Roper and Mar.
	if (ccdDetector() == VESPERS::Roper)
		totalTime *= time() + timeOffset_ + 6.0;
	else if (ccdDetector() == VESPERS::Mar)
		totalTime *= time() + timeOffset_ + 3.0;
	else
		totalTime *= time() + timeOffset_;

	totalTime_ = totalTime + 9;
	setExpectedDuration(totalTime_);
	emit totalTimeChanged(totalTime_);
}