PMPostTransferRoutine.cs 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. using System;
  2. using Aitex.Core.RT.DataCenter;
  3. using Aitex.Core.RT.Routine;
  4. using Aitex.Core.RT.SCCore;
  5. using JetVirgoPM.Devices;
  6. using MECF.Framework.Common.Routine;
  7. using MECF.Framework.Common.Schedulers;
  8. using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.PMs;
  9. using MECF.Framework.RT.ModuleLibrary.SystemModules;
  10. namespace JetVirgoPM.PMs.Routines
  11. {
  12. class PMPostTransferRoutine : PMRoutineBase, IStepRoutine
  13. {
  14. enum RoutineStep
  15. {
  16. PumpDown,
  17. SetLiftPin,
  18. WaitNotExtendToPMON,
  19. SetSlitDoor,
  20. SlitDoorDelay,
  21. kEnd
  22. }
  23. private int _timeout;
  24. private EnumDualPM _pos;
  25. public PMPostTransferRoutine(JetDualPM chamber) : base(chamber)
  26. {
  27. Name = "PostTransfer";
  28. }
  29. public RState Init(EnumTransferType type, int[] slot)
  30. {
  31. _pos = (slot.Length > 1) ? EnumDualPM.Both : (slot[0] == 0) ? EnumDualPM.Left : EnumDualPM.Right;
  32. if (SC.IsDoubleFork) _pos = EnumDualPM.Both;
  33. return RState.End;
  34. }
  35. public RState Start(params object[] objs)
  36. {
  37. Reset();
  38. _timeout = SC.GetValue<int>($"{Module}.PrepareTransferTimeout");
  39. return Runner.Start(_chamber.Module.ToString(), Name);
  40. }
  41. public RState Monitor()
  42. {
  43. //只在TMCycle中降pin,其余在Recipe中控制
  44. if (DATA.Poll("Rt", "Status").ToString() == RtState.TMCycling.ToString())
  45. {
  46. Runner.Run(RoutineStep.SetLiftPin, HOFs.Apply(SetLiftPinUpDown, _pos, false), HOFs.Apply(ChecktLiftPinUpDown, _pos, false))
  47. .Run(RoutineStep.WaitNotExtendToPMON, WaitNotExtendToPMON, CheckWaitNotExtendToPMON, _timeout * 1000)
  48. .Run(RoutineStep.SetSlitDoor, HOFs.Apply(SetSlitDoor, _pos, false), HOFs.Apply(CheckSlitDoor, _pos, false), _timeout * 1000)
  49. .End(RoutineStep.kEnd, EndFunc, _delay_0s);
  50. }
  51. else
  52. {
  53. Runner.Run(RoutineStep.WaitNotExtendToPMON, WaitNotExtendToPMON, CheckWaitNotExtendToPMON, _timeout * 1000)
  54. .Run(RoutineStep.SetSlitDoor, HOFs.Apply(SetSlitDoor, _pos, false), HOFs.Apply(CheckSlitDoor, _pos, false), _timeout * 1000)
  55. .End(RoutineStep.kEnd, EndFunc, _delay_0s);
  56. }
  57. return Runner.Status;
  58. }
  59. public override void Abort() { }
  60. bool WaitNotExtendToPMON()
  61. {
  62. Func<bool> notifyFunc = () => { Notify($"等待 Not Extend To PM 信号ON"); return true; };
  63. return ((_pos != EnumDualPM.Left || _chamber.IsTMRobotNotExtendToPM1) || notifyFunc()) &&
  64. ((_pos != EnumDualPM.Right || _chamber.IsTMRobotNotExtendToPM2) || notifyFunc());
  65. }
  66. private bool CheckWaitNotExtendToPMON()
  67. {
  68. return ((_pos != EnumDualPM.Left) || _chamber.IsTMRobotNotExtendToPM1) && ((_pos != EnumDualPM.Right) || _chamber.IsTMRobotNotExtendToPM2);
  69. }
  70. }
  71. }