|
|
@ -10,6 +10,7 @@ import org.slf4j.Logger; |
|
|
|
import org.slf4j.LoggerFactory; |
|
|
|
|
|
|
|
import java.util.HashMap; |
|
|
|
import java.util.List; |
|
|
|
import java.util.Map; |
|
|
|
|
|
|
|
public class StartResetTaskThread extends Thread { |
|
|
@ -27,98 +28,61 @@ public class StartResetTaskThread extends Thread { |
|
|
|
this.setProgressMessage("设备初始化..."); |
|
|
|
|
|
|
|
UfCmdSnippetExecutor.execute("StartResetInitDevices"); |
|
|
|
|
|
|
|
try { |
|
|
|
Thread.sleep(5000); |
|
|
|
} catch (InterruptedException e) { |
|
|
|
throw new RuntimeException(e); |
|
|
|
// this.setupHeatingSlotCover(); |
|
|
|
// this.setupPeristalticPump(); |
|
|
|
if ( this.isErrorTubeRackRequired ) { |
|
|
|
this.setupErrorTubeRack(); |
|
|
|
} |
|
|
|
|
|
|
|
this.setupHeatingSlotCover(); |
|
|
|
// this.setupPeristalticPump(); |
|
|
|
// |
|
|
|
// this.setProgressMessage("设备初始化 : 相机"); |
|
|
|
// DiActCameraBasler camera = this.getActuator(MyDevice.ACT_CAMERA, DiActCameraBasler.class); |
|
|
|
// camera.setEnable(true); |
|
|
|
// |
|
|
|
// this.setProgressMessage("设备初始化 : 定时刷新加热盘温度"); |
|
|
|
// var slotMan = this.getResourceManager(ResHeatingTubeRackSlotManager.class); |
|
|
|
// slotMan.startTemperatureRefresh(); |
|
|
|
// |
|
|
|
// if ( this.isErrorTubeRackRequired ) { |
|
|
|
// this.setProgressMessage("设备初始化 : 放入异常处理试管架"); |
|
|
|
// doorMotor.reset(); // 打开设备门 |
|
|
|
// DiMdbNotification.taskAction(this, "TaskStartResetErrorTubeRackPutIn"); |
|
|
|
// this.waitAction("TaskStartResetErrorTubeRackPutIn"); |
|
|
|
// } |
|
|
|
// |
|
|
|
// this.getDevice().getIO().setValue("LightRed", 0); |
|
|
|
// this.getDevice().getIO().setValue("LightGreen", 1); |
|
|
|
|
|
|
|
this.setProgressMessage("设备初始化 : 定时刷新加热盘温度"); |
|
|
|
device.heatingTurntable.temperatureMonitorStart(); |
|
|
|
|
|
|
|
UfCmdSnippetExecutor.execute("StatusLampRunning"); |
|
|
|
this.setProgressMessage("设备初始化 : 完成"); |
|
|
|
device.setStatus("ready"); |
|
|
|
UfMdbRuntimeVariable.setString("设备已就绪","device.message"); |
|
|
|
} |
|
|
|
// |
|
|
|
// // 设置蠕动泵 |
|
|
|
// private void setupPeristalticPump() { |
|
|
|
// int peristalticPumpCount = 1; |
|
|
|
// var actuators = this.getDevice().getActuators().getAll(); |
|
|
|
// for ( var actuator : actuators ) { |
|
|
|
// if (actuator instanceof DiActPeristalticPump pump) { |
|
|
|
// this.setProgressMessage("设备初始化 : 蠕动泵复位 " + peristalticPumpCount + "/16"); |
|
|
|
// pump.setEnable(true); |
|
|
|
// peristalticPumpCount++; |
|
|
|
// } |
|
|
|
// } |
|
|
|
// |
|
|
|
// Boolean enableSetup = this.getDevice().getEnv().getProperty("app.liquidPeristalticPumpPipeSetupEnable",Boolean.class); |
|
|
|
// assert enableSetup != null; |
|
|
|
// if ( !enableSetup ) { |
|
|
|
// return ; |
|
|
|
// } |
|
|
|
// |
|
|
|
// DiActMotor liquidPlateMotor = this.getActuator(MyDevice.ACT_LIQUID_PLATE_MOTOR, DiActMotor.class); |
|
|
|
// DiActMotor liquidMotor = this.getActuator(MyDevice.ACT_LIQUID_MOTOR, DiActMotor.class); |
|
|
|
// |
|
|
|
// this.setProgressMessage("设备初始化 : 初始化加液管路"); |
|
|
|
// MoveDoorOpen.execute(this.getDevice()); |
|
|
|
// DiMdbNotification.taskAction(this, "TaskStartResetPumpPipeSetupTubeRankPutIn"); |
|
|
|
// this.waitAction("TaskStartResetPumpPipeSetupTubeRankPutIn"); |
|
|
|
// MoveDoorClose.execute(this.getDevice()); |
|
|
|
// |
|
|
|
// // 加液管充满 |
|
|
|
// for ( int i=0; i<8; i++ ) { |
|
|
|
|
|
|
|
// 设置蠕动泵 |
|
|
|
private void setupPeristalticPump() { |
|
|
|
for ( int i=0; i<16; i++ ) { |
|
|
|
// this.setProgressMessage("设备初始化 : 初始化蠕动泵 " + (i+1) + "/16"); |
|
|
|
// UfCmdSnippetExecutor.execute(String.format("PeristalticPumpEnable.%d",i)); |
|
|
|
} |
|
|
|
|
|
|
|
Boolean enableSetup = UfApplication.getApp().getEnv().getProperty("app.liquidPeristalticPumpPipeSetupEnable",Boolean.class); |
|
|
|
assert enableSetup != null; |
|
|
|
if ( !enableSetup ) { |
|
|
|
return ; |
|
|
|
} |
|
|
|
|
|
|
|
this.setProgressMessage("设备初始化 : 初始化加液管路"); |
|
|
|
UfCmdSnippetExecutor.execute("DoorOpen"); |
|
|
|
UfMdbNotification.action("TaskStartResetPumpPipeSetupTubeRankPutIn", new HashMap<>()); |
|
|
|
this.waitAction("TaskStartResetPumpPipeSetupTubeRankPutIn"); |
|
|
|
UfCmdSnippetExecutor.execute("DoorClose"); |
|
|
|
|
|
|
|
// 加液管充满 |
|
|
|
Device device = Device.getInstance(); |
|
|
|
var tubes = List.of(0,4, 3,2, 15,11, 12,13, 1,5, 6,7, 14,10, 9,8); |
|
|
|
for ( int i=0; i<8; i++ ) { |
|
|
|
// this.setProgressMessage("设备初始化 : 初始化加液管路 " + (i+1) + "/8"); |
|
|
|
// if ( 0 == i%2 ) { |
|
|
|
// liquidMotor.moveTo("LiquidArmPumpGroupOut"); |
|
|
|
// liquidPlateMotor.moveTo("LiquidPlateSlotPumpOutGroup",i/2); |
|
|
|
// } else { |
|
|
|
// liquidMotor.moveTo("LiquidArmPumpGroupIn"); |
|
|
|
// liquidPlateMotor.moveTo("LiquidPlateSlotPumpInGroup", i/2); |
|
|
|
// } |
|
|
|
// |
|
|
|
// 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), |
|
|
|
// () -> pump1.moveBy(pipeVolumeCircle1) |
|
|
|
// )); |
|
|
|
// pump0.retract(); |
|
|
|
// pump1.retract(); |
|
|
|
// } |
|
|
|
// |
|
|
|
// liquidMotor.moveTo("LiquidArmStandby"); |
|
|
|
// |
|
|
|
// // 加液管充满, 需要取出试管架 |
|
|
|
// MoveDoorOpen.execute(this.getDevice()); |
|
|
|
// DiMdbNotification.taskAction(this, "TaskStartResetPumpPipeSetupTubeRankTakeOut"); |
|
|
|
// this.waitAction("TaskStartResetPumpPipeSetupTubeRankTakeOut"); |
|
|
|
// MoveDoorClose.execute(this.getDevice()); |
|
|
|
// } |
|
|
|
// |
|
|
|
// var tubeList = tubes.subList(i*2, i*2+2); |
|
|
|
// var pumpList = List.of(2*i, 2*i+1); |
|
|
|
// device.liquidAddition.addLiquidToTubes(tubeList, pumpList, 10000); |
|
|
|
} |
|
|
|
|
|
|
|
// 加液管充满, 需要取出试管架 |
|
|
|
UfCmdSnippetExecutor.execute("DoorOpen"); |
|
|
|
UfMdbNotification.action("TaskStartResetPumpPipeSetupTubeRankTakeOut", new HashMap<>()); |
|
|
|
this.waitAction("TaskStartResetPumpPipeSetupTubeRankTakeOut"); |
|
|
|
UfCmdSnippetExecutor.execute("DoorClose"); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 清理试管架 |
|
|
|
* @issue : <a href="http://127.0.0.1:5566/issues/85">无法获取加液位置是否存在试管架</a> |
|
|
@ -173,43 +137,21 @@ public class StartResetTaskThread extends Thread { |
|
|
|
UfCmdSnippetExecutor.execute("DoorClose"); |
|
|
|
} |
|
|
|
} |
|
|
|
// |
|
|
|
// // 异常处理位试管架取出 |
|
|
|
// public void actionErrorTubeRackTakeOut() { |
|
|
|
// var action = this.getAction("TaskStartResetErrorTubeRackTakeOut"); |
|
|
|
// action.finish(); |
|
|
|
// } |
|
|
|
// |
|
|
|
// // 放入异常处理位试管架 |
|
|
|
// public void actionErrorTubeRackPutIn() { |
|
|
|
// var slotMan = this.getResourceManager(ResHeatingTubeRackSlotManager.class); |
|
|
|
// var slot = slotMan.getErrorSlot(); |
|
|
|
// |
|
|
|
// // 关闭设备门 |
|
|
|
// DiActMotor doorMotor = this.getActuator(MyDevice.ACT_DOOR_MOTOR, DiActMotor.class); |
|
|
|
// doorMotor.moveToIO(1, 1); |
|
|
|
// |
|
|
|
// var move = new MoveMoveTubeRackFromLiquidPlateToHeatPlate(); |
|
|
|
// move.slotIndex = slot.index; |
|
|
|
// move.setDevice(this.getDevice()); |
|
|
|
// move.run(); |
|
|
|
// slot.lock(); |
|
|
|
// |
|
|
|
// var action = this.getAction("TaskStartResetErrorTubeRackPutIn"); |
|
|
|
// action.finish(); |
|
|
|
// } |
|
|
|
// |
|
|
|
// // 蠕动泵管路初始化 |
|
|
|
// public void actionPumpPipeSetupTubeRankPutIn() { |
|
|
|
// var action = this.getAction("TaskStartResetPumpPipeSetupTubeRankPutIn"); |
|
|
|
// action.finish(); |
|
|
|
// } |
|
|
|
// |
|
|
|
// // 蠕动泵管路初始化 |
|
|
|
// public void actionPumpPipeSetupTubeRankTakeOut() { |
|
|
|
// var action = this.getAction("TaskStartResetPumpPipeSetupTubeRankTakeOut"); |
|
|
|
// action.finish(); |
|
|
|
// } |
|
|
|
|
|
|
|
// 放入异常处理位试管架 |
|
|
|
public void setupErrorTubeRack() { |
|
|
|
Integer errorSlotIndex = UfApplication.getApp().getEnv().getProperty("app.errorSlotIndex", Integer.class); |
|
|
|
|
|
|
|
this.setProgressMessage("设备初始化 : 放入异常处理试管架"); |
|
|
|
UfCmdSnippetExecutor.execute("DoorOpen"); |
|
|
|
UfMdbNotification.action("TaskStartResetErrorTubeRackPutIn", new HashMap<>()); |
|
|
|
this.waitAction("TaskStartResetErrorTubeRackPutIn"); |
|
|
|
// 关闭设备门 |
|
|
|
UfCmdSnippetExecutor.execute("DoorClose"); |
|
|
|
// 移动试管架至异常处理区 |
|
|
|
UfCmdSnippetExecutor.execute(String.format("TubeRackMoveToHeatingTurntable.%d", errorSlotIndex)); |
|
|
|
Device.getInstance().heatingTurntable.getSlotByIndex(errorSlotIndex).setTubeRackNo("ErrorSlot"); |
|
|
|
} |
|
|
|
|
|
|
|
// wait for continue |
|
|
|
private void waitAction( String key ) { |
|
|
|