123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148 |
- 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 MFPurgeRoutine : ModuleRoutineBase, IRoutine
- {
- private enum PurgeStep
- {
- kCloseValves,
- kPumpToCrossing,
- kPumpToBase,
- kPurgeDelay_1,
- kPurgeVent,
- kPurgeDelay_2,
- kPurgePumpToCrossing,
- kPurgePumpToBase,
- kPurgePumpDelay,
- kPurgeEnd,
- kEnd,
- }
- public int PurgeCounter { get; private set; }
- private double _basePressure = 100;
- private double _CrossingPressure = 2000;
- private double _purgeVentPressure = 10;
- private int _purgeCycleCounter = 30;
- private int _purgePumpTime = 120;
- private readonly JetTM _JetTM;
- public MFPurgeRoutine(JetTM tm, ModuleName mod) : base(mod)
- {
- Name = $"{Module} Purge";
- _JetTM = tm;
- }
- public RState Start(params object[] objs)
- {
- if (_JetTM.CheckLidClosed(Module) &&
- _JetTM.CheckVentValveClosed(Module) &&
- _JetTM.CheckPurgeValveClosed(Module) &&
- _JetTM.CheckPumpValveClosed(Module))
- {
- Reset();
- _JetTM.CloseModuleAllValves(Module);
- _basePressure = SC.GetValue<double>($"{Module}.PumpBasePressure");
- _CrossingPressure = SC.GetValue<double>($"{Module}.PumpCrossingPressure");
- _purgeVentPressure = SC.GetValue<double>($"{Module}.PurgeVentPressure");
- _purgeCycleCounter = SC.GetValue<int>($"{Module}.PurgeCycleCount");
- _purgePumpTime = SC.GetValue<int>($"{Module}.PurgePumpTime");
- //_JetTM.TurnN2Valve(true);
- PurgeCounter = 0;
- return Runner.Start(Module, Name);
- }
- return RState.Failed;
- }
- public RState Monitor()
- {
- Runner.Delay(PurgeStep.kCloseValves, _delay_1s)
- .Run(PurgeStep.kPumpToCrossing, HOFs.WrapAction(_JetTM.TurnSoftPumpValve, Module, true), () => { return _JetTM.GetModulePressure(Module) < _CrossingPressure; })
- .Run(PurgeStep.kPumpToBase, SwitchFastPump, () => { return _JetTM.GetModulePressure(Module) < _basePressure; })
- .LoopStart(PurgeStep.kPurgeDelay_1, "Purge", _purgeCycleCounter, HOFs.WrapAction(_JetTM.TurnFastPumpValve, Module, false), _delay_1s)
- .LoopRun(PurgeStep.kPurgeVent, OpenPurge, () => { return _JetTM.GetModulePressure(Module) >= _purgeVentPressure; })
- .LoopRun(PurgeStep.kPurgeDelay_2, ClosePurge, _delay_1s)
- //.LoopRun(PurgeStep.kPurgePumpToCrossing, HOFs.WrapAction(_JetTM.TurnSoftPumpValve, Module, true), () => { return _JetTM.GetModulePressure(Module) < _basePressure; })
- .LoopRun(PurgeStep.kPurgePumpToBase, SwitchFastPump, () => { return _JetTM.GetModulePressure(Module) < _basePressure; })
- //.LoopRun(PurgeStep.kPurgePumpDelay, NullFun, _purgePumpTime * 1000)
- .LoopEnd(PurgeStep.kPurgeEnd, HOFs.WrapAction(_JetTM.CloseModuleAllValves, Module), _delay_1s)
- .End(PurgeStep.kEnd, NullFun, _delay_50ms);
- return Runner.Status;
- }
- public void Abort()
- {
- if (Module == ModuleName.LLA)
- {
- _JetTM.SetLLAFlow(0);
- }
- else if (Module == ModuleName.LLB)
- {
- _JetTM.SetLLBFlow(0);
- }
- _JetTM.CloseModuleAllValves(Module);
- }
- private bool SwitchFastPump()
- {
- _JetTM.TurnSoftPumpValve(Module, false);
- _JetTM.TurnFastPumpValve(Module, true);
- return true;
- }
- private bool OpenPurge()
- {
- _JetTM.TurnN2Valve(true);
- if (Module == ModuleName.TM)
- {
- _JetTM.TurnVentValve(Module, true);
- }
- else
- {
- if (Module == ModuleName.LLA)
- {
- _JetTM.SetLLAFlow(2000);
- }
- else if(Module == ModuleName.LLB)
- {
- _JetTM.SetLLBFlow(2000);
- }
- _JetTM.TurnPurgeValve(Module, true);
- }
- return true;
- }
- public bool ClosePurge()
- {
- _JetTM.TurnN2Valve(false);
- if (Module == ModuleName.TM)
- {
- _JetTM.TurnVentValve(Module, false);
- }
- else
- {
- if (Module == ModuleName.LLA)
- {
- _JetTM.SetLLAFlow(0);
- }
- else if (Module == ModuleName.LLB)
- {
- _JetTM.SetLLBFlow(0);
- }
- _JetTM.TurnPurgeValve(Module, false);
- }
- return true;
- }
- }
- }
|