| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109 | 
							- using Aitex.Core.RT.Log;
 
- using Aitex.Core.RT.Routine;
 
- using Aitex.Core.RT.SCCore;
 
- using MECF.Framework.Common.Equipment;
 
- using System;
 
- using System.Collections.Generic;
 
- using System.Linq;
 
- using System.Text;
 
- using System.Threading.Tasks;
 
- using Venus_Core;
 
- using Venus_RT.Devices;
 
- namespace Venus_RT.Modules.TM.VenusEntity
 
- {
 
-     public class SEMFVentRoutine : ModuleRoutineBase, IRoutine
 
-     {
 
-         private enum SEVentStep
 
-         {
 
-             seOpenSoftVent,
 
-             seSwitchFastVent,
 
-             seDelayForClose,
 
-             seCloseVentValves,
 
-         }
 
-         private int _venttimeout;
 
-         private int _ventcrosspressure;
 
-         private readonly HongHuTM _tm;
 
-         public SEMFVentRoutine(HongHuTM tm, ModuleName module) : base(module)
 
-         {
 
-             _tm = tm;
 
-             Name = "Vent";
 
-         }
 
-         public RState Start(params object[] objs)
 
-         {
 
-             if (_tm.CheckPumpValveClosed(Module))
 
-             {
 
-                 Reset();
 
-                 _venttimeout = SC.GetValue<int>($"{Module}.VentingTimeout") * 1000;
 
-                 _ventcrosspressure = SC.GetValue<int>($"{Module}.SoftVentEndPressure");
 
-                 return Runner.Start(Module, Name);
 
-             }
 
-             else
 
-             {
 
-                 LOG.Write(eEvent.ERR_DEVICE_INFO,Module, "Pump Valve not all Close! Cannot Vent!");
 
-                 return RState.Failed;
 
-             }
 
-         }
 
-         public RState Monitor()
 
-         {
 
-             Runner.Run(SEVentStep.seOpenSoftVent,           OpenSoftVentValve,          IsSoftVentEnd)
 
-                    .Run(SEVentStep.seSwitchFastVent,        SwitchFastVentValve,        IsPressureReady,        _venttimeout)
 
-                    .Delay(SEVentStep.seDelayForClose,       _delay_1s)
 
-                    .End(SEVentStep.seCloseVentValves,       CloseVentValve,             _delay_50ms);
 
-             return Runner.Status;
 
-         }
 
-         private bool OpenSoftVentValve()
 
-         {
 
-             _tm.TurnSoftVentValve(Module, true);
 
-             return true;
 
-         }
 
-         private bool IsSoftVentEnd() => _tm.GetModulePressure(Module) > _ventcrosspressure;
 
-         private bool SwitchFastVentValve()
 
-         {
 
-             if (Module == ModuleName.SETM)
 
-                 _tm.SetTMFlow(100);
 
-             _tm.TurnSoftVentValve(Module, false);
 
-             _tm.TurnFastVentValve(Module, true);
 
-             return true;
 
-         }
 
-         private bool IsPressureReady()
 
-         {
 
-             switch (Module)
 
-             {
 
-                case ModuleName.SETM:
 
-                     return _tm.IsTMATM;
 
-                case ModuleName.VCE1:
 
-                     return _tm.IsVCEATM;
 
-             }
 
-             return false;
 
-         }
 
-         private bool CloseVentValve()
 
-         {
 
-             _tm.TurnSoftVentValve(Module,false);
 
-             _tm.TurnFastVentValve(Module,false);
 
-             if (Module == ModuleName.SETM)
 
-                 _tm.SetTMFlow(0);
 
-             return true;
 
-         }
 
-         public void Abort()
 
-         {
 
-             _tm.TurnFastVentValve(Module,false);
 
-             _tm.TurnSoftVentValve(Module, false);
 
-         }
 
-     }
 
- }
 
 
  |