PostProcess.cs 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239
  1. using System;
  2. using System.Collections.Generic;
  3. using Aitex.Core.RT.Event;
  4. using Aitex.Core.RT.Log;
  5. using Aitex.Core.RT.SCCore;
  6. using Aitex.RT.Properties;
  7. using Aitex.Triton160.RT.Module;
  8. using Aitex.Core.Util;
  9. using Aitex.Platform;
  10. using Aitex.Core.Equipment.SusceptorDefine;
  11. using Aitex.Core.RT.Routine;
  12. using Aitex.Triton160.RT.Device;
  13. namespace Aitex.Triton160.RT.Routine.Process
  14. {
  15. public class PostProcess : CommonRoutine
  16. {
  17. private enum RoutineStep
  18. {
  19. DelayForTest,
  20. RFPowerOff,
  21. StopGasFlow,
  22. CloseAllValves,
  23. ClosePumpValve,
  24. DelayWaitValve,
  25. Loop,
  26. Pump,
  27. PumpDelay,
  28. Vent,
  29. VentDelay,
  30. EndLoop,
  31. ClosePurgeValve,
  32. VentEndToPrecision,
  33. VentEndDelay,
  34. VentEndCloseVentValve,
  35. End,
  36. };
  37. private RecipeHead head;
  38. public string RecipeName
  39. {
  40. get;
  41. private set;
  42. }
  43. public string RecipeContex
  44. {
  45. get;
  46. private set;
  47. }
  48. private bool PurgeActive
  49. {
  50. get
  51. {
  52. if (head != null)
  53. {
  54. if (!string.IsNullOrEmpty(head.PurgeActive))
  55. {
  56. return Convert.ToBoolean(head.PurgeActive);
  57. }
  58. }
  59. return true;
  60. }
  61. }
  62. private int _purgeCycleCount;
  63. private int _purgeVentPressure;
  64. private int _purgePumpPressure;
  65. private int _purgeVentTimeLimit;
  66. private int _purgePumpTimeLimit;
  67. private int _purgeVentStableTime;
  68. private int _purgePumpStableTime;
  69. private int _ventTime;
  70. //private int _ventTimeLimit;
  71. public PostProcess(string module, string name)
  72. {
  73. Module = module;
  74. Name = name;
  75. Display = Resources.PostProcess_PostProcess_PostProcess;
  76. }
  77. public bool Initialize()
  78. {
  79. InitCommon();
  80. return true;
  81. }
  82. public void Terminate()
  83. {
  84. }
  85. public Result Start(params object[] objs)
  86. {
  87. try
  88. {
  89. Reset();
  90. this.UpdateSCValue();
  91. RecipeName = (string)objs[0];
  92. RecipeContex = (string)objs[1];
  93. List<RecipeStep> recipeSteps;
  94. if (!Recipe.Parse(RecipeContex, out head, out recipeSteps))
  95. {
  96. return Result.FAIL;
  97. }
  98. _purgeCycleCount = (int)SC.GetValue<double>(SCName.ProcessConfig_PurgeCycleCount);
  99. _purgeVentPressure = (int)SC.GetValue<double>(SCName.ProcessConfig_PurgeVentPressure);
  100. _purgePumpPressure = (int)SC.GetValue<double>(SCName.ProcessConfig_PurgePumpPressure);
  101. _purgeVentTimeLimit = (int)SC.GetValue<double>(SCName.ProcessConfig_PurgeVentTimeLimit);
  102. _purgePumpTimeLimit = (int)SC.GetValue<double>(SCName.ProcessConfig_PurgePumpTimeLimit);
  103. _purgeVentStableTime = (int)SC.GetValue<double>(SCName.ProcessConfig_PurgeVentStableTime);
  104. _purgePumpStableTime = (int)SC.GetValue<double>(SCName.ProcessConfig_PurgePumpStableTime);
  105. _ventTime = (int)SC.GetSC<double>(SCName.System_VentTime).Value;
  106. //_ventTimeLimit = (int)SC.GetSC<double>(SCName.System_VentTimeLimit).Value;
  107. }
  108. catch (Exception ex)
  109. {
  110. LOG.Write(ex, String.Format("Postprocess Start has exception"));
  111. return Result.FAIL;
  112. }
  113. return Result.RUN;
  114. }
  115. public Result Monitor()
  116. {
  117. try
  118. {
  119. if (SC.GetValue<bool>(SCName.System_IsSimulatorMode))
  120. {
  121. Delay((int) RoutineStep.DelayForTest, Resources.PostProcess_Monitor_WaitFor10Seconds, 10, Notify, Stop);
  122. }
  123. RFPowerOff((int)RoutineStep.RFPowerOff, Resources.PostProcess_Monitor_RFPowerOff, Notify, Stop);
  124. StopAllGasFlow((int)RoutineStep.StopGasFlow, Resources.PostProcess_Monitor_StopAllTheGasFlow, 10, Notify, Stop);
  125. CloseAllValve((int)RoutineStep.CloseAllValves, Resources.PumpDownRoutine_Monitor_CloseAllTheValves, 10, Notify, Stop);
  126. if (PurgeActive)
  127. {
  128. Loop((int)RoutineStep.Loop, Resources.CyclePurgeRoutine_Monitor_StartCyclePurge, _purgeCycleCount, Notify, Stop);
  129. CyclePump((int)RoutineStep.Pump, Resources.CyclePurgeRoutine_Monitor_Pumping, _purgePumpPressure, _purgePumpTimeLimit, true, Notify, Stop);
  130. Delay((int)RoutineStep.PumpDelay, string.Format(Resources.PostProcess_Monitor_PumpDelay0Seconds, _purgePumpStableTime), _purgePumpStableTime, Notify, Stop);
  131. CycleVent((int)RoutineStep.Vent, Resources.CyclePurgeRoutine_Monitor_Venting, _purgeVentPressure, _purgeVentTimeLimit, true, Notify, Stop);
  132. Delay((int)RoutineStep.VentDelay, string.Format(Resources.PostProcess_Monitor_VentDelay0Seconds, _purgeVentStableTime), _purgeVentStableTime, Notify, Stop);
  133. EndLoop((int)RoutineStep.EndLoop, Notify, Stop);
  134. }
  135. else
  136. {
  137. ClosePumpValve((int)RoutineStep.ClosePumpValve, Resources.StopPumpRoutine_Monitor_ClosePumpValve, valveOpenCloseTimeout, Notify, Stop);
  138. Delay((int)RoutineStep.DelayWaitValve, string.Format("delay 3 seconds" ), 3, Notify, Stop);
  139. }
  140. VentToPrecision((int)RoutineStep.VentEndToPrecision, string.Format(Resources.VentRountine_Monitor_Vent0Seconds, _ventTime), _ventTime, Notify, Stop);
  141. CloseValve((int)RoutineStep.VentEndCloseVentValve, Resources.VentRountine_Monitor_VentValve, DeviceModel.ValveChamberVent, valveOpenCloseTimeout, Notify, Stop);
  142. End((int)RoutineStep.End, Resources.PostProcess_Monitor_PostProcessFinished, Notify, Stop);
  143. }
  144. catch (RoutineBreakException)
  145. {
  146. return Result.RUN;
  147. }
  148. catch (RoutineFaildException)
  149. {
  150. return Result.FAIL;
  151. }
  152. return Result.DONE;
  153. }
  154. public void Exit()
  155. {
  156. if (DeviceModel.SignalTower != null)
  157. {
  158. DeviceModel.SignalTower.BuzzerBlinking(SC.GetValue<double>(SCName.System_BuzzerBlinkingTime));
  159. DeviceModel.SignalTower.SetLight(LightType.YELLOW, LightStatus.ON);
  160. }
  161. //update processing end time
  162. Singleton<ProcessRecorder>.Instance.EndRecipeProcess(Singleton<PMEntity>.Instance.CurrentRunningJob.RecipeRunId, SusceptorStatus.Processed);
  163. }
  164. private new void Notify(string message)
  165. {
  166. Singleton<ProcessRecorder>.Instance.AddRecord(Singleton<PMEntity>.Instance.CurrentRunningJob.RecipeRunId, CarrierDataType.PreProcessStep, "", "Post process:" + message);
  167. EV.PostMessage(Module, EventEnum.PostProcessInfo, Module, message);
  168. }
  169. private new void Stop(string message)
  170. {
  171. Singleton<ProcessRecorder>.Instance.AddRecord(Singleton<PMEntity>.Instance.CurrentRunningJob.RecipeRunId, CarrierDataType.PostProcessErrorEnd, "", "post process, exception," + message);
  172. EV.PostMessage(Module, EventEnum.PostProcessErr, Module, message);
  173. EV.PostPopDialogMessage(EventLevel.Alarm, string.Format(Resources.PostProcess_Stop_0FailedAfterRunningRecipe, Module),
  174. string.Format(Resources.PreProcess_Stop_Recipe0RNFailedReason1, RecipeName, message));
  175. }
  176. }
  177. }