PumpDownRoutine.cs 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Windows.Forms;
  6. using Aitex.Core.RT.SCCore;
  7. using Aitex.RT.Properties;
  8. using Aitex.Triton160.RT.Device;
  9. using Aitex.Core.RT.Event;
  10. using Aitex.Triton160.Common;
  11. using Aitex.Core.RT.IOCore;
  12. using Aitex.Core.RT.Routine;
  13. namespace Aitex.Triton160.RT.Routine.PM
  14. {
  15. public class PumpDownRoutine : CommonRoutine
  16. {
  17. private enum PumpDown
  18. {
  19. CheckDoor,
  20. CheckDryPump,
  21. CloseAllVavle,
  22. OpenPumpingValve,
  23. CheckVAC,
  24. End,
  25. };
  26. private double _basePressure;
  27. private double _pumpTimeLimit;
  28. public PumpDownRoutine(string module, string name)
  29. {
  30. Module = module;
  31. Name = name;
  32. Display = Resources.PumpDownRoutine_PumpDownRoutine_PumpingDown;
  33. bUINotify = true;
  34. }
  35. public bool Initialize()
  36. {
  37. InitCommon();
  38. return true;
  39. }
  40. public void Terminate()
  41. {
  42. }
  43. public Result Start( )
  44. {
  45. Reset();
  46. UpdateSCValue();
  47. _basePressure = SC.GetSC<double>(SCName.System_PumpBasePressure).Value;
  48. _pumpTimeLimit = SC.GetSC<double>(SCName.System_PumpTimeLimit).Value;
  49. return Result.RUN;
  50. }
  51. public Result Monitor()
  52. {
  53. try
  54. {
  55. //检查Door
  56. CheckDoor((int)PumpDown.CheckDoor, Resources.PumpDownRoutine_Monitor_CheckDoorStatus, Notify, Stop);
  57. //检查 Dry Pump
  58. CheckDryPump((int)PumpDown.CheckDryPump, Resources.PumpDownRoutine_Monitor_CheckPumpStatus, Notify, Stop);
  59. //关闭所有阀门
  60. CloseAllValve((int)PumpDown.CloseAllVavle, Resources.PumpDownRoutine_Monitor_CloseAllTheValves, 10, Notify, Stop);
  61. //打开
  62. OpenPumpingValve((int)PumpDown.OpenPumpingValve, Resources.PumpDownRoutine_Monitor_OpenPumpingValve, 10, Notify, Stop);
  63. //检查VAC
  64. CheckVAC((int)PumpDown.CheckVAC, string.Format( Resources.PumpDownRoutine_Monitor_WaitChamberPressureUntilBelow0, _basePressure), _basePressure, (int)_pumpTimeLimit, Notify, Stop);
  65. End((int)PumpDown.End, Resources.PumpDownRoutine_Monitor_PumpingDownCompleted, Notify, Stop);
  66. }
  67. catch (RoutineBreakException)
  68. {
  69. return Result.RUN;
  70. }
  71. catch (RoutineFaildException)
  72. {
  73. return Result.FAIL;
  74. }
  75. return Result.DONE;
  76. }
  77. public new Result Abort()
  78. {
  79. base.Abort();
  80. string reason = string.Empty;
  81. if (!DeviceModel.ValveChamberPumping.TurnValve(false, out reason))
  82. {
  83. Notify(reason);
  84. return Result.FAIL;
  85. }
  86. return Result.DONE;
  87. }
  88. }
  89. }