CyclePurgeRoutine.cs 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using Aitex.Core.RT.Event;
  6. using Aitex.Core.RT.SCCore;
  7. using Aitex.RT.Properties;
  8. using Aitex.Triton160.Common;
  9. using Aitex.Core.RT.IOCore;
  10. using Aitex.Core.RT.Routine;
  11. using Aitex.Triton160.RT.Device;
  12. namespace Aitex.Triton160.RT.Routine.PM
  13. {
  14. public class CyclePurgeRoutine : CommonRoutine
  15. {
  16. private enum RoutineStep
  17. {
  18. CheckRfOff,
  19. CheckPumping,
  20. CloseAllValves,
  21. Loop,
  22. Pump,
  23. PumpDelay,
  24. Vent,
  25. VentDelay,
  26. EndLoop,
  27. PumpDefault,
  28. End,
  29. };
  30. private int _purgeCycleCount;
  31. private int _purgeVentPressure;
  32. private int _purgePumpPressure;
  33. private int _purgeVentTimeLimit;
  34. private int _purgePumpTimeLimit;
  35. private int _purgeVentStableTime;
  36. private int _purgePumpStableTime;
  37. public CyclePurgeRoutine(string module, string name)
  38. {
  39. Module = module;
  40. Name = name;
  41. Display = Resources.CyclePurgeRoutine_CyclePurgeRoutine_CyclePurge;
  42. bUINotify = true;
  43. }
  44. public bool Initialize()
  45. {
  46. InitCommon();
  47. return true;
  48. }
  49. public void Terminate()
  50. {
  51. }
  52. public Result Start(params object[] objs)
  53. {
  54. Reset();
  55. UpdateSCValue();
  56. _purgeCycleCount = (int)SC.GetValue<double>(SCName.ProcessConfig_PurgeCycleCount);
  57. _purgeVentPressure = (int)SC.GetValue<double>(SCName.ProcessConfig_PurgeVentPressure);
  58. _purgePumpPressure = (int)SC.GetValue<double>(SCName.ProcessConfig_PurgePumpPressure);
  59. _purgeVentTimeLimit = (int)SC.GetValue<double>(SCName.ProcessConfig_PurgeVentTimeLimit);
  60. _purgePumpTimeLimit = (int)SC.GetValue<double>(SCName.ProcessConfig_PurgePumpTimeLimit);
  61. _purgeVentStableTime = (int)SC.GetValue<double>(SCName.ProcessConfig_PurgeVentStableTime);
  62. _purgePumpStableTime = (int)SC.GetValue<double>(SCName.ProcessConfig_PurgePumpStableTime);
  63. return Result.RUN;
  64. }
  65. public Result Monitor()
  66. {
  67. try
  68. {
  69. CheckRfOff((int)RoutineStep.CheckRfOff, Resources.StopPumpRoutine_Monitor_CheckIfTheRfIsOn);
  70. CheckPumpingOn((int)RoutineStep.CheckPumping, Resources.CyclePurgeRoutine_Monitor_CheckIfThePumpValveOpen);
  71. //CheckGasFlowStopped((int)RoutineStep.CheckGasFlow, "Check if the gas stopped flowing");
  72. //关闭所有阀门
  73. CloseAllValve((int)RoutineStep.CloseAllValves, Resources.PumpDownRoutine_Monitor_CloseAllTheValves, 10, Notify, Stop);
  74. Loop((int)RoutineStep.Loop, Resources.CyclePurgeRoutine_Monitor_StartCyclePurge, _purgeCycleCount, Notify, Stop);
  75. CyclePump((int)RoutineStep.Pump, Resources.CyclePurgeRoutine_Monitor_Pumping, _purgePumpPressure, _purgePumpTimeLimit, true, Notify, Stop);
  76. Delay((int)RoutineStep.PumpDelay, string.Format("pump delay {0} seconds", _purgePumpStableTime), _purgePumpStableTime, Notify, Stop);
  77. CycleVent((int)RoutineStep.Vent, Resources.CyclePurgeRoutine_Monitor_Venting, _purgeVentPressure, _purgeVentTimeLimit, true, Notify, Stop);
  78. Delay((int)RoutineStep.VentDelay, string.Format("vent delay {0} seconds", _purgeVentStableTime), _purgeVentStableTime, Notify, Stop);
  79. EndLoop((int)RoutineStep.EndLoop, Notify, Stop);
  80. CyclePump((int)RoutineStep.PumpDefault, Resources.CyclePurgeRoutine_Monitor_KeepInPumpingStatus, _purgePumpPressure, _purgePumpTimeLimit, false, Notify, Stop);
  81. End((int)RoutineStep.End, Resources.CyclePurgeRoutine_Monitor_CyclePurgeFinished, Notify, Stop);
  82. }
  83. catch (RoutineBreakException)
  84. {
  85. return Result.RUN;
  86. }
  87. catch (RoutineFaildException)
  88. {
  89. return Result.FAIL;
  90. }
  91. return Result.DONE;
  92. }
  93. }
  94. }