PMTransferHandoffRoutine.cs 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. using System;
  2. using Aitex.Core.RT.Routine;
  3. using Aitex.Core.RT.SCCore;
  4. using JetVirgoPM.Devices;
  5. using MECF.Framework.Common.Routine;
  6. using MECF.Framework.Common.Schedulers;
  7. using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.PMs;
  8. namespace JetVirgoPM.PMs.Routines
  9. {
  10. class PMTransferHandoffRoutine : PMRoutineBase, IStepRoutine
  11. {
  12. enum RoutineStep
  13. {
  14. SetPin,
  15. kEnd
  16. }
  17. private int _timeout;
  18. private EnumTransferType _TransferType;
  19. private EnumDualPM _pos;
  20. public PMTransferHandoffRoutine(JetDualPM chamber) : base(chamber)
  21. {
  22. Name = "TransferHandoff";
  23. }
  24. public RState Init(EnumTransferType type, int[] slot)
  25. {
  26. _TransferType = type;
  27. _pos = (slot.Length > 1) ? EnumDualPM.Both : (slot[0] == 0) ? EnumDualPM.Left : EnumDualPM.Right;
  28. if (SC.IsDoubleFork) _pos = EnumDualPM.Both;
  29. return RState.End;
  30. }
  31. public RState Start(params object[] objs)
  32. {
  33. Reset();
  34. _timeout = SC.GetValue<int>($"{Module}.PrepareTransferTimeout");
  35. return Runner.Start(_chamber.Module.ToString(), Name);
  36. }
  37. public RState Monitor()
  38. {
  39. var isUp = false;
  40. var pos = EnumDualPM.None;
  41. if (_TransferType == EnumTransferType.Pick || _TransferType == EnumTransferType.Place)
  42. {
  43. isUp = _TransferType == EnumTransferType.Pick ? false : true;
  44. pos = _pos;
  45. }
  46. Runner.Run(RoutineStep.SetPin, HOFs.Apply(SetLiftPinUpDown, pos, isUp), HOFs.Apply(ChecktLiftPinUpDown, pos, isUp), _timeout * 1000)
  47. .End(RoutineStep.kEnd, EndFunc, _delay_0s);
  48. return Runner.Status;
  49. }
  50. public override void Abort() { }
  51. }
  52. }