VentRountine.cs 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Drawing;
  4. using System.Linq;
  5. using System.Text;
  6. using Aitex.Core.RT.Device;
  7. using Aitex.Core.RT.Event;
  8. using Aitex.Core.RT.SCCore;
  9. using Aitex.RT.Properties;
  10. using Aitex.Triton160.RT.Device;
  11. using Aitex.Core.RT.IOCore;
  12. using Aitex.Triton160.Common;
  13. using Aitex.Core.RT.Routine;
  14. namespace Aitex.Triton160.RT.Routine.PM
  15. {
  16. public class VentRountine : CommonRoutine
  17. {
  18. private enum Routine
  19. {
  20. CheckPSW,
  21. ClosePumpValve1,
  22. ClosePumpValve2,
  23. CloseALLValve,
  24. OpenVentValve,
  25. VentToPrecision,
  26. VentDelay,
  27. CloseVentValve,
  28. End,
  29. }
  30. private int _ventTime;
  31. private int _ventTimeDelay = 2; //执行Vent程序时(自动或手动Vent),先关闭PV2,延时2秒后打开PV3。
  32. public VentRountine(string module, string name)
  33. {
  34. Module = module;
  35. Name = name;
  36. Display = Resources.VentRountine_VentRountine_Vent;
  37. bUINotify = true;
  38. }
  39. public bool Initialize()
  40. {
  41. InitCommon();
  42. return true;
  43. }
  44. public void Terminate()
  45. {
  46. }
  47. public Result Start()
  48. {
  49. Reset();
  50. _ventTime = (int)SC.GetSC<double>(SCName.System_VentTime).Value;
  51. //_ventTimeLimit = (int)SC.GetSC<double>(SCName.System_VentTimeLimit).Value;
  52. return Result.RUN;
  53. }
  54. public Result Monitor()
  55. {
  56. try
  57. {
  58. //检查PSW通讯
  59. CheckPSWCommunaction((int)Routine.CheckPSW, Resources.VentRountine_Monitor_CheckSensor, Notify, Stop);
  60. CloseValve((int)Routine.ClosePumpValve2, Resources.VentRountine_Monitor_PumpingOpenValve, DeviceModel.ValveChamberPumping, valveOpenCloseTimeout, Notify, Stop);
  61. CloseAllValve((int)Routine.CloseALLValve, Resources.VentRountine_Monitor_CloseAllTheValve, 10, Notify, Stop);
  62. Delay((int)Routine.VentDelay, string.Format(Resources.VentRountine_Monitor_VentDelay0SecondsBeforeOpenVentValve, _ventTimeDelay), _ventTimeDelay, Notify, Stop);
  63. //打开V9
  64. OpenValve((int)Routine.OpenVentValve, Resources.VentRountine_Monitor_VentValve, DeviceModel.ValveChamberVent, valveOpenCloseTimeout, Notify, Stop);
  65. VentToPrecision((int)Routine.VentToPrecision, string.Format(Resources.VentRountine_Monitor_Vent0Seconds, _ventTime), _ventTime, Notify, Stop);
  66. //vent delay
  67. //Delay((int)Routine.VentDelay, string.Format("vent delay {0} seconds on {1}mTorr", _ventTimeDelay, DeviceModel.PressureMeterChamber.Precision), _ventTimeDelay, Notify, Stop);
  68. CloseValve((int)Routine.CloseVentValve, Resources.VentRountine_Monitor_VentValve, DeviceModel.ValveChamberVent, valveOpenCloseTimeout, Notify, Stop);
  69. End((int)Routine.End, Resources.VentRountine_Monitor_VentCompleted, Notify, Stop);
  70. }
  71. catch (RoutineBreakException)
  72. {
  73. return Result.RUN;
  74. }
  75. catch (RoutineFaildException)
  76. {
  77. return Result.FAIL;
  78. }
  79. return Result.DONE;
  80. }
  81. public new Result Abort()
  82. {
  83. base.Abort();
  84. string reason = string.Empty;
  85. if (DeviceModel.ValveChamberVent!= null && !DeviceModel.ValveChamberVent.TurnValve(false, out reason))
  86. {
  87. Notify(reason);
  88. return Result.FAIL;
  89. }
  90. return Result.DONE;
  91. }
  92. }
  93. }