| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113 | 
							- using Aitex.Core.RT.Routine;
 
- using Aitex.Core.RT.SCCore;
 
- using Venus_RT.Devices;
 
- using MECF.Framework.Common.Routine;
 
- using MECF.Framework.Common.Equipment;
 
- using Venus_Core;
 
- namespace Venus_RT.Modules.TM
 
- {
 
-     class MFPumpRoutine : ModuleRoutineBase, IRoutine
 
-     {
 
-         private enum PumpStep
 
-         {
 
-             kWaitPeerModule,
 
-             kSoftPump,
 
-             kFastPump,
 
-             kClosePumpValves,
 
-         }
 
-         private double _pumpBasePressure;
 
-         private double _pumpCrossingPressure;
 
-         private int _pumpingTimeout;
 
-         private readonly JetTM _JetTM;
 
-         public MFPumpRoutine(JetTM jetTM, ModuleName mod) : base(mod)
 
-         {
 
-             _JetTM = jetTM;
 
-             Name = "Pump Down";
 
-         }
 
-         public RState Start(params object[] objs)
 
-         {
 
-             if (_JetTM.CheckLidClosed(Module) && 
 
-                 _JetTM.CheckVentValveClosed(Module) && 
 
-                 _JetTM.CheckPurgeValveClosed(Module))
 
-             {
 
-                 Reset();
 
-                 _pumpBasePressure = SC.GetValue<double>($"{Module}.PumpBasePressure");
 
-                 _pumpCrossingPressure = SC.GetValue<double>($"{Module}.PumpCrossingPressure");
 
-                 _pumpingTimeout = SC.GetValue<int>($"{Module}.PumpingTimeout") * 1000;
 
-                 return Runner.Start(Module, Name);
 
-             }
 
-             return RState.Failed;
 
-         }
 
-         public RState Monitor()
 
-         {
 
-             Runner.Wait((int)PumpStep.kWaitPeerModule,  WaitPeerModule)
 
-                 .Run((int)PumpStep.kSoftPump,           OpenSoftPump,                       () => { return _JetTM.GetModulePressure(Module) < _pumpCrossingPressure; }, _pumpingTimeout)
 
-                 .Run((int)PumpStep.kFastPump,           SwitchFastPump,                     IsPressureReady,                                                            _pumpingTimeout)
 
-                 .End((int)PumpStep.kClosePumpValves,    ClosePumpValves,                    _delay_50ms);
 
-             return Runner.Status;
 
-         }
 
-         private bool WaitPeerModule()
 
-         {
 
-             if(!IsPressureReady())
 
-             {
 
-                 if (Module == ModuleName.LLA)
 
-                 {
 
-                     return !_JetTM.IsLLBFastPumpOpen && !_JetTM.IsLLBSoftPumpOpen;
 
-                 }
 
-                 else if (Module == ModuleName.LLB)
 
-                 {
 
-                     return !_JetTM.IsLLAFastPumpOpen && !_JetTM.IsLLASoftPumpOpen;
 
-                 }
 
-             }
 
-             
 
-             return true;
 
-         }
 
-         private bool IsPressureReady()
 
-         {
 
-             return _JetTM.GetModulePressure(Module) < _pumpBasePressure;
 
-         }
 
-         private bool OpenSoftPump()
 
-         {
 
-             if (!IsPressureReady())
 
-             {
 
-                 _JetTM.TurnSoftPumpValve(Module, true);
 
-             }
 
-             return true;
 
-         }
 
-         private bool SwitchFastPump()
 
-         {
 
-             if (!IsPressureReady())
 
-             {
 
-                 _JetTM.TurnSoftPumpValve(Module, false);
 
-                 _JetTM.TurnFastPumpValve(Module, true);
 
-             }
 
-             return true;
 
-         }
 
-         private bool ClosePumpValves()
 
-         {
 
-             _JetTM.TurnSoftPumpValve(Module, false);
 
-             _JetTM.TurnFastPumpValve(Module, false);
 
-             return true;
 
-         }
 
-         public void Abort()
 
-         {
 
-             ClosePumpValves();
 
-         }
 
-     }
 
- }
 
 
  |