PMVATPerformanceRoutine.cs 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. using Aitex.Core.RT.Routine;
  2. using Aitex.Core.RT.SCCore;
  3. using System;
  4. using System.Collections.Generic;
  5. using System.Linq;
  6. using System.Text;
  7. using System.Threading.Tasks;
  8. using Venus_Core;
  9. using Venus_RT.Devices;
  10. namespace Venus_RT.Modules.PMs
  11. {
  12. class PMVATPerformanceRoutine : PMRoutineBase, IRoutine
  13. {
  14. int gasIndex;
  15. //int GasMaxScale;
  16. public int counter;
  17. int gasTime;
  18. int gasSetPoint;
  19. ValveType[] valveTypes = new ValveType[4] { ValveType.PV11, ValveType.PV21, ValveType.PV31, ValveType.PV41 };
  20. List<int> Positions = new List<int>() {50,100,150,200,250,300,350,400,450,500,550,600,650,700,750,800,850,900,950,1000};
  21. private enum VATPerformanceStep
  22. {
  23. kDelay_1s,
  24. kStartGas,
  25. kReadChamberPressure,
  26. kEnd,
  27. }
  28. public PMVATPerformanceRoutine(JetPM chamber) : base(chamber)
  29. {
  30. Name = "PMVATPerformance";
  31. }
  32. public RState Start(params object[] objs)
  33. {
  34. if (!CheckTurboPump())
  35. {
  36. return RState.Failed;
  37. }
  38. if (_chamber.GetPVPosition() == 0)
  39. {
  40. Stop("钟摆阀没有打开");
  41. return RState.Failed;
  42. }
  43. _chamber.OpenValve(ValveType.Guage, true);
  44. _chamber.OpenValve(ValveType.TurboPumpPumping, true);
  45. _chamber.OpenValve(ValveType.TurboPumpPurge, true);
  46. counter = 1;
  47. Reset();
  48. gasIndex = (int)objs[0];
  49. gasTime = (int)objs[1];
  50. gasSetPoint = (int)objs[2];
  51. //_chamber.CloseValves();
  52. //_chamber.SetPVPostion(25);
  53. return Runner.Start(Module, Name);
  54. }
  55. public RState Monitor()
  56. {
  57. Runner.Delay((int)VATPerformanceStep.kDelay_1s, 1000 * 1)
  58. .LoopStart((int)VATPerformanceStep.kStartGas, "VAT Performance Test", Positions.Count, () => SetPositionGas(), gasTime)
  59. .LoopEnd((int)VATPerformanceStep.kReadChamberPressure, ReadChamberPressure, _delay_1s)
  60. .End((int)VATPerformanceStep.kEnd, () =>
  61. {
  62. _chamber.CloseValves();
  63. return true;
  64. }, 500);
  65. return Runner.Status;
  66. }
  67. private bool SetPositionGas()
  68. {
  69. if (!_chamber.SetPVPostion(Positions[counter - 1]))
  70. {
  71. return false;
  72. }
  73. if (gasIndex <= 4)
  74. {
  75. _chamber.OpenValve(valveTypes[gasIndex - 1], true);
  76. }
  77. _chamber.OpenValve(ValveType.GasFinal, true);
  78. _chamber.FlowGas(gasIndex - 1, gasSetPoint);
  79. return true;
  80. }
  81. private bool ReadChamberPressure()
  82. {
  83. counter += 1;
  84. return true;
  85. }
  86. public void Abort()
  87. {
  88. _chamber.CloseValves();
  89. }
  90. }
  91. }