123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154 |
- using Aitex.Core.RT.Routine;
- using Aitex.Core.RT.SCCore;
- using Venus_RT.Devices;
- using MECF.Framework.Common.Routine;
- using Venus_Core;
- namespace Venus_RT.Modules.PMs
- {
- class PMPurgeRoutine : PMRoutineBase, IRoutine
- {
- private enum PurgeStep
- {
- kStart,
- kCloseValvesExceptN2Purge,
- kPurgeVent,
- kStopVent,
- kCloseISOValve,
- kSoftPump,
- kFastPump,
- kCloseFastPump,
- kOpenISOValve,
- kOpenVATValve,
- kOpenV8N2Purge,
- kCloseVATValve,
- kEnd,
- }
- public int PurgeCounter { get; private set; }
- private readonly int _pumpingTargetPressure = 200;
- private int _purgeVentPressure = 1000;
- private int _roughPumpDownPressure = 75;
- private int _purgePumpTime = 60;
- private int _purgeCycleCount = 30;
- private JetChamber jetChamber = JetChamber.None;
- private bool needsoft = true;
- public PMPurgeRoutine(JetPMBase chamber) : base(chamber)
- {
- jetChamber = (JetChamber)SC.GetValue<int>($"{chamber.Name}.ChamberType");
- Name = "PM Purge";
- if (jetChamber == JetChamber.VenusDE)
- {
- needsoft = false;
- }
- }
- public RState Start(params object[] objs)
- {
- if (CheckLid() &&
- CheckSlitDoor() &&
- CheckDryPump() &&
- CheckTurboPump())
- {
- _purgeVentPressure = SC.GetValue<int>($"{Module}.Purge.PurgeVentPressure");
- _roughPumpDownPressure = SC.GetValue<int>($"{Module}.Purge.PurgePumpPressure") * 1000;
- _purgePumpTime = SC.GetValue<int>($"{Module}.Purge.PurgePumpTime");
- _purgeCycleCount = SC.GetValue<int>($"{Module}.Purge.PurgeCycleCount");
- Reset();
- //CloseValvesExceptN2Purge();
- PurgeCounter = 0;
- return Runner.Start(Module, Name);
- }
- return RState.Failed;
- }
- public RState Monitor()
- {
- Runner.Delay(PurgeStep.kStart, _delay_1s)
- .LoopStart(PurgeStep.kCloseValvesExceptN2Purge, "Purge Cycle", _purgeCycleCount, CloseValvesExceptN2Purge, _delay_5s)
- .LoopRun(PurgeStep.kPurgeVent, OpenVentValves, () => { return _chamber.ChamberPressure >= _purgeVentPressure; })
- .LoopRun(PurgeStep.kStopVent, CloseVentValves, _delay_2s)
- .LoopRun(PurgeStep.kCloseISOValve, HOFs.WrapAction(_chamber.OpenValve, ValveType.TurboPumpPumping, false), _delay_2s)
- .LoopRunIf(PurgeStep.kSoftPump, needsoft, HOFs.WrapAction(_chamber.OpenValve, ValveType.SoftPump, true), () => { return _chamber.ChamberPressure <= _roughPumpDownPressure; })
- .LoopRun(PurgeStep.kFastPump, StartFastPump, () => { return _chamber.ChamberPressure <= _pumpingTargetPressure; })
- .LoopRun(PurgeStep.kCloseFastPump, HOFs.WrapAction(_chamber.OpenValve, ValveType.FastPump, false), _delay_2s)
- .LoopRun(PurgeStep.kOpenISOValve, HOFs.WrapAction(_chamber.OpenValve, ValveType.TurboPumpPumping, true), _delay_2s)
- .LoopRun(PurgeStep.kOpenVATValve, HOFs.Apply(_chamber.TurnPendulumValve, true), _delay_5s)
- .LoopRun(PurgeStep.kOpenV8N2Purge, OpenV8N2Purge, (_purgePumpTime - 5) * 1000)
- .LoopEnd(PurgeStep.kCloseVATValve, CloseVATValve, _delay_1s)
- .End(PurgeStep.kEnd, NullFun, _delay_1s);
- return Runner.Status;
- }
- public void Abort()
- {
- CloseAllValves();
- }
- private bool CloseValvesExceptN2Purge()
- {
- _chamber.OpenValve(ValveType.Guage, false);
- _chamber.OpenValve(ValveType.SoftPump, false);
- _chamber.OpenValve(ValveType.FastPump, false);
- _chamber.TurnPendulumValve(false);
- _chamber.OpenValve(ValveType.GasFinal, false);
- _chamber.OpenValve(ValveType.N2, false);
- _chamber.OpenValve(ValveType.PVN22, true);
- _chamber.OpenValve(ValveType.TurboPumpPumping, true);
- _chamber.OpenValve(ValveType.TurboPumpPurge, true);
- return true;
- }
- private bool OpenVentValves()
- {
- _chamber.OpenValve(ValveType.GasFinal, true);
- _chamber.OpenValve(ValveType.N2, true);
- return true;
- }
- private bool CloseVentValves()
- {
- _chamber.OpenValve(ValveType.GasFinal, false);
- _chamber.OpenValve(ValveType.N2, false);
- _chamber.OpenValve(ValveType.PVN22, false);
- _chamber.OpenValve(ValveType.TurboPumpPurge, false);
- return true;
- }
- private bool StartFastPump()
- {
- _chamber.OpenValve(ValveType.SoftPump, false);
- _chamber.OpenValve(ValveType.FastPump, true);
- return true;
- }
- private bool OpenV8N2Purge()
- {
- _chamber.OpenValve(ValveType.Guage, true);
- _chamber.OpenValve(ValveType.TurboPumpPurge, true);
- return true;
- }
- private bool CloseVATValve()
- {
- _chamber.TurnPendulumValve(false);
- PurgeCounter++;
- return true;
- }
- }
- }
|