diff --git a/src/src/main/java/com/my/graphiteDigesterBg/task/TaskStopReset.java b/src/src/main/java/com/my/graphiteDigesterBg/task/TaskStopReset.java index 9321849..0342280 100644 --- a/src/src/main/java/com/my/graphiteDigesterBg/task/TaskStopReset.java +++ b/src/src/main/java/com/my/graphiteDigesterBg/task/TaskStopReset.java @@ -6,8 +6,13 @@ import com.my.graphiteDigesterBg.diframe.actuator.DiActCameraBasler; import com.my.graphiteDigesterBg.diframe.actuator.DiActMotor; import com.my.graphiteDigesterBg.diframe.actuator.DiActPeristalticPump; import com.my.graphiteDigesterBg.diframe.actuator.DiActServo; +import com.my.graphiteDigesterBg.diframe.model.DiMdbNotification; import com.my.graphiteDigesterBg.model.MdbOperationLog; import com.my.graphiteDigesterBg.resource.ResHeatingTubeRackSlotManager; + +import java.util.ArrayList; +import java.util.List; + @Task(name="StopReset") public class TaskStopReset extends DiTaskBase { @Override @@ -16,61 +21,63 @@ public class TaskStopReset extends DiTaskBase { MdbOperationLog.log(this.getUser(), "停止复位"); var runtimeVars = this.getDevice().getRuntimeVariables(); - // 结束温度刷新 + this.setProgressMessage("结束温度刷新"); var slotMan = this.getResourceManager(ResHeatingTubeRackSlotManager.class); slotMan.stopTemperatureRefresh(); - // 相机关闭 + this.setProgressMessage("关闭相机"); DiActCameraBasler camera = this.getActuator(MyDevice.ACT_CAMERA, DiActCameraBasler.class); camera.setEnable(false); - // 关闭设备门 + this.setProgressMessage("关闭设备门"); DiActMotor doorMotor = this.getActuator(MyDevice.ACT_DOOR_MOTOR, DiActMotor.class); doorMotor.moveToIO(1, 1); doorMotor.setEnable(false); - // 关闭夹爪 + this.setProgressMessage("关闭夹爪"); DiActServo transferClipServo = this.getActuator(MyDevice.ACT_TRANSFER_CLIP_SERVO, DiActServo.class); transferClipServo.moveTo("TransClipServoClose"); transferClipServo.setEnable(false); - // 加液臂复位 + this.setProgressMessage("加液臂复位"); DiActMotor liquidMotor = this.getActuator(MyDevice.ACT_LIQUID_MOTOR, DiActMotor.class); liquidMotor.reset(); liquidMotor.moveTo("LiquidArmStandby"); liquidMotor.setEnable(false); - // 搬运机械臂上下移动复 - DiActMotor transUdMotor = this.getActuator(MyDevice.ACT_TRANSFER_UD_MOTOR, DiActMotor.class); - transUdMotor.reset(); - transUdMotor.moveTo("TransUdMotorStandby"); - transUdMotor.setEnable(false); - - // 搬运机械臂左右移动复 + this.setProgressMessage("搬运机械臂左右移动复"); DiActMotor transLrMotor = this.getActuator(MyDevice.ACT_TRANSFER_LR_MOTOR, DiActMotor.class); transLrMotor.reset(); transLrMotor.moveTo("TransLrMotorStandby"); transLrMotor.setEnable(false); - // 加热盘转盘槽盖关闭 + this.setProgressMessage("搬运机械臂上下移动复"); + DiActMotor transUdMotor = this.getActuator(MyDevice.ACT_TRANSFER_UD_MOTOR, DiActMotor.class); + transUdMotor.reset(); + transUdMotor.moveTo("TransUdMotorStandby"); + transUdMotor.setEnable(false); + + this.setProgressMessage("关闭试管架盖"); for ( int i=0; i<5; i++ ) { String key = "HeatingPlateMotorSlotCover_" + i; DiActServo heatSlotCoverServo = this.getActuator(key, DiActServo.class); heatSlotCoverServo.setEnable(false); } - // 加热盘转盘复位 + this.setProgressMessage("加液盘转盘复位"); DiActMotor liquidPlateMotor = this.getActuator(MyDevice.ACT_LIQUID_PLATE_MOTOR, DiActMotor.class); liquidPlateMotor.reset(); liquidPlateMotor.setEnable(false); - // 加热盘转盘复位 + this.setProgressMessage("加热盘转盘复位"); DiActMotor heatPlateMotor = this.getActuator(MyDevice.ACT_HEAT_PLATE_MOTOR, DiActMotor.class); heatPlateMotor.reset(); heatPlateMotor.moveTo("HeatPlateStandby"); heatPlateMotor.setEnable(false); - // 蠕动泵复位 + this.cleanLiquidPipes(); + + this.setProgressMessage("蠕动泵复位"); int peristalticPumpCount = 1; var actuators = this.getDevice().getActuators().getAll(); for ( var actuator : actuators ) { @@ -81,6 +88,27 @@ public class TaskStopReset extends DiTaskBase { } runtimeVars.setString("NO","IsDeviceReady"); + DiMdbNotification.taskAction(this, "TaskStopResetFinished"); this.setStatus(TaskStatus.FINISHED); } + + // clean liquid pipes + private void cleanLiquidPipes() { + for ( int i=0; i<8; i++) { + var pump0 = this.getActuator("LiquidPeristalticPump_"+i+"_0", DiActPeristalticPump.class); + var pump1 = this.getActuator("LiquidPeristalticPump_"+i+"_1", DiActPeristalticPump.class); + var pipeVolumeCircle0 = pump1.getLocationValue("LiquidPeristalticPumpPipeVolumeCircle",i, 0); + var pipeVolumeCircle1 = pump1.getLocationValue("LiquidPeristalticPumpPipeVolumeCircle",i, 1); + this.batchExecute(List.of( + () -> pump0.moveBy(pipeVolumeCircle0 * -1), + () -> pump1.moveBy(pipeVolumeCircle1 * -1) + )); + } + } + + // set progress message + private void setProgressMessage(String message) { + var runtimeVars = this.getDevice().getRuntimeVariables(); + runtimeVars.setString(message, "TaskStopResetMessage"); + } }