//– Dispense back into vessel and then pipette nothing //– Ignore clot error and continue //– Discard the DITI and pipette nothing private void ProcessClot(Labware labware, int wellID, double volume, LiquidClass liquidClass, out PipettingResult pipettingResult, string barcode = "") { string labwareLabel = labware.Label; ClotDetectedForm clotForm = new ClotDetectedForm(); clotForm.ShowDialog(); e_RSPErrorCode res = e_RSPErrorCode.RSP_ERROR_NONE; var userSelection = clotForm.UserSelection; pipettingResult = PipettingResult.ok; DitiTrackInfo trackInfo = new DitiTrackInfo(Labware.WasteLabel, 1, true, false); switch (userSelection) { case ClotDetectedAction.dispenseBackThenDropDiti: pipettingResult = PipettingResult.clotDispenseBack; res = MoveController.Instance.Move2Z(_eARM.左臂, labware.ZValues.ZDispense); ThrowCriticalException(res, "遇到凝块,移动到ZDispense"); res = MoveController.Instance.Dispense(volume + excessVolume, liquidClass.AspirationSinglePipetting.AspirationSpeed, startSpeedV, endSpeedV); ThrowCriticalException(res, "遇到凝块,打回容器"); DropTip(out trackInfo); break; case ClotDetectedAction.dropDiti: pipettingResult = PipettingResult.clotDropDiti; DropTip(out trackInfo); break; case ClotDetectedAction.ignore: pipettingResult = PipettingResult.clotIgnore; break; } }
////when stop move triggers, we check whether we have moved the minium distance, ////if not, we move the remaining distance public void StopMove() { Axis axis = ConvertDir2Axis(dir); dir = Direction.None; e_RSPErrorCode res = MoveController.Instance.StopMove(enumMapper[armType], axis); }
void ThrowIfErrorHappened(e_RSPErrorCode res) { if (res != e_RSPErrorCode.RSP_ERROR_NONE) { throw new CriticalException(res.ToString()); } }
private void ThrowCriticalException(e_RSPErrorCode res) { if (res != e_RSPErrorCode.RSP_ERROR_NONE) { throw new CriticalException(res.ToString()); } }
public void StartMove(ArmType armType, WorkstationController.Hardware.Direction dir, int speedMMPerSecond) { startPosition = GetPosition(armType); this.dir = dir; this.armType = armType; this.speedMMPerSecond = speedMMPerSecond; if (armType == ArmType.Roma) { GetClipperInfo(ref degree, ref clipWidth); } var eArmType = enumMapper[armType]; //var res = MoveController.Instance.StartMove(enumMapper[armType], (Direction)dir, speedMMPerSecond); e_RSPErrorCode res = e_RSPErrorCode.RSP_ERROR_NONE; e_CanMotorID motorID = e_CanMotorID.CanMotorID_Max; double absPosition = 0; switch (dir) { case Direction.Left: case Direction.Right: motorID = armType == ArmType.Liha ? e_CanMotorID.CanMotorID_Left_x : e_CanMotorID.CanMotorID_Right_x; absPosition = dir == Direction.Left ? 0 : 700; res = MoveController.Instance.StartMove(eArmType, Axis.X, speedMMPerSecond, absPosition, 0); Debug.WriteLine(string.Format("movex result:{0}", res.ToString())); break; case Direction.Up: case Direction.Down: motorID = armType == ArmType.Liha ? e_CanMotorID.CanMotorID_Left_y : e_CanMotorID.CanMotorID_Right_y; absPosition = dir == Direction.Down ? 400 : 0; res = MoveController.Instance.StartMove(eArmType, Axis.Y, speedMMPerSecond, absPosition, 0); break; case Direction.ZDown: case Direction.ZUp: motorID = armType == ArmType.Liha ? e_CanMotorID.CanMotorID_Left_z : e_CanMotorID.CanMotorID_Right_z; absPosition = dir == Direction.ZUp ? 0 : 300; res = MoveController.Instance.StartMove(eArmType, Axis.Z, speedMMPerSecond, absPosition, 0); break; case Direction.RotateCCW: case Direction.RotateCW: this.armType = ArmType.Roma; motorID = e_CanMotorID.CanMotorID_Rotate; absPosition = dir == Direction.RotateCCW ? 360 : 720; res = MoveController.Instance.StartMove(_eARM.右臂, Axis.R, speedMMPerSecond, absPosition, 0); break; case Direction.ClampOff: case Direction.ClampOn: this.armType = ArmType.Roma; motorID = e_CanMotorID.CanMotorID_Clipper; absPosition = dir == Direction.ClampOff ? 0 : 20; res = MoveController.Instance.StartMove(_eARM.右臂, Axis.Clipper, speedMMPerSecond, absPosition, 0); break; } ThrowIfErrorHappened(res); }
private void ThrowCriticalException(e_RSPErrorCode res, string actionDesc = "") { if (res != e_RSPErrorCode.RSP_ERROR_NONE) { string addtionalInfo = actionDesc == "" ? "" : string.Format("在{0}中发生错误:", actionDesc); addtionalInfo += res.ToString(); log.Error(addtionalInfo); throw new CriticalException(addtionalInfo); } }