AMAction3* AMScanActionControllerScanAssembler::generateActionTreeForStepAxis(AMControl *axisControl, AMScanAxis *stepScanAxis){ AMListAction3 *axisActions = new AMListAction3(new AMListActionInfo3(QString("Axis %1").arg(axisControl->name()), QString("Axis %1").arg(axisControl->name())), AMListAction3::Sequential); // generate axis initialization list AMListAction3 *initializationActions = new AMListAction3(new AMListActionInfo3(QString("Initializing %1").arg(axisControl->name()), QString("Initializing Axis with Control %1").arg(axisControl->name())), AMListAction3::Sequential); AMControlInfo initializeControlPositionSetpoint = axisControl->toInfo(); initializeControlPositionSetpoint.setValue(stepScanAxis->axisStart()); AMControlMoveAction3 *initializeControlPosition = new AMControlMoveAction3(new AMControlMoveActionInfo3(initializeControlPositionSetpoint), axisControl); initializeControlPosition->setGenerateScanActionMessage(true); initializationActions->addSubAction(initializeControlPosition); AMListAction3 *allRegionsList = new AMListAction3(new AMListActionInfo3(QString("%1 Regions for %2 Axis").arg(stepScanAxis->regionCount()).arg(axisControl->name()), QString("%1 Regions for %2 Axis").arg(stepScanAxis->regionCount()).arg(axisControl->name())), AMListAction3::Sequential); for(int x = 0; x < stepScanAxis->regionCount(); x++) allRegionsList->addSubAction(generateActionTreeForStepAxisRegion(axisControl, stepScanAxis->regionAt(x), (x == stepScanAxis->regionCount()-1) )); // generate axis cleanup list AMListAction3 *cleanupActions = new AMListAction3(new AMListActionInfo3(QString("Cleaning Up %1").arg(axisControl->name()), QString("Cleaning Up Axis with Control %1").arg(axisControl->name())), AMListAction3::Sequential); AMAxisStartedAction *axisStartAction = new AMAxisStartedAction(new AMAxisStartedActionInfo(QString("%1 Axis").arg(axisControl->name()), AMScanAxis::StepAxis)); AMAxisFinishedAction *axisFinishAction = new AMAxisFinishedAction(new AMAxisFinishedActionInfo(QString("%1 Axis").arg(axisControl->name()))); axisActions->addSubAction(axisStartAction); axisActions->addSubAction(initializationActions); axisActions->addSubAction(allRegionsList); axisActions->addSubAction(cleanupActions); axisActions->addSubAction(axisFinishAction); return axisActions; }
AMAction3* CLSSIS3820Scaler::createWaitForDwellFinishedAction(double timeoutTime) { if(!isConnected()) return 0; //NULL AMControlInfo setpoint = startToggle_->toInfo(); setpoint.setValue(0); AMControlWaitActionInfo *actionInfo = new AMControlWaitActionInfo(setpoint, timeoutTime , AMControlWaitActionInfo::MatchEqual); AMControlWaitAction *action = new AMControlWaitAction(actionInfo, startToggle_); if(!action) return 0; //NULL return action; }
AMAction3* AMScanActionControllerScanAssembler::generateActionTreeForStepAxisRegion(AMControl *axisControl, const AMScanAxisRegion &stepScanAxisRegion, bool isFinalRegion){ AMListAction3 *regionList = new AMListAction3(new AMListActionInfo3(QString("Region on %1").arg(axisControl->name()), QString("Region from %1 to %2 by %3 on %4").arg(stepScanAxisRegion.regionStart().toString()).arg(stepScanAxisRegion.regionEnd().toString()).arg(stepScanAxisRegion.regionStep().toString()).arg(axisControl->name())), AMListAction3::Sequential); AMControlInfo regionStartSetpoint = axisControl->toInfo(); regionStartSetpoint.setValue(stepScanAxisRegion.regionStart()); AMControlMoveAction3 *regionStart = new AMControlMoveAction3(new AMControlMoveActionInfo3(regionStartSetpoint), axisControl); regionStart->setGenerateScanActionMessage(true); AMListAction3 *detectorSetDwellList = new AMListAction3(new AMListActionInfo3(QString("Set All Detectors Dwell Times"), QString("Set %1 Detectors").arg(detectors_->count())), AMListAction3::Parallel); AMAction3 *detectorSetDwellAction; for(int x = 0; x < detectors_->count(); x++){ detectorSetDwellAction = detectors_->at(x)->createSetAcquisitionTimeAction(stepScanAxisRegion.regionTime()); if(detectorSetDwellAction) detectorSetDwellList->addSubAction(detectorSetDwellAction); } // generate axis loop for region int loopIterations = ceil(( ((double)stepScanAxisRegion.regionEnd()) - ((double)stepScanAxisRegion.regionStart()) )/ ((double)stepScanAxisRegion.regionStep()) ); AMLoopAction3 *axisLoop = new AMLoopAction3(new AMLoopActionInfo3(loopIterations, QString("Loop %1").arg(axisControl->name()), QString("Looping from %1 to %2 by %3 on %4").arg(stepScanAxisRegion.regionStart().toString()).arg(stepScanAxisRegion.regionEnd().toString()).arg(stepScanAxisRegion.regionStep().toString()).arg(axisControl->name()))); axisLoop->setGenerateScanActionMessage(true); AMListAction3 *nextLevelHolderAction = new AMListAction3(new AMListActionInfo3("Holder Action for the Next Sublevel", "Holder Action for the Next Sublevel")); AMControlInfo controlLoopMoveInfoSetpoint = axisControl->toInfo(); controlLoopMoveInfoSetpoint.setValue(stepScanAxisRegion.regionStep()); AMControlMoveActionInfo3 *controlLoopMoveInfo = new AMControlMoveActionInfo3(controlLoopMoveInfoSetpoint); controlLoopMoveInfo->setIsRelativeMove(true); controlLoopMoveInfo->setIsRelativeFromSetpoint(true); AMControlMoveAction3 *controlLoopMove = new AMControlMoveAction3(controlLoopMoveInfo, axisControl); controlLoopMove->setGenerateScanActionMessage(true); axisLoop->addSubAction(nextLevelHolderAction); axisLoop->addSubAction(controlLoopMove); regionList->addSubAction(regionStart); regionList->addSubAction(detectorSetDwellList); regionList->addSubAction(axisLoop); if(isFinalRegion){ AMListAction3 *nextLevelFinalHolderAction = new AMListAction3(new AMListActionInfo3("Holder Action for the Next Sublevel", "Holder Action for the Next Sublevel")); regionList->addSubAction(nextLevelFinalHolderAction); } return regionList; }