123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383 |
- using System;
- using Aitex.Core.RT.Routine;
- using Aitex.Core.RT.SCCore;
- using Venus_RT.Devices;
- using MECF.Framework.Common.Routine;
- using Venus_Core;
- using Aitex.Core.RT.Log;
- namespace Venus_RT.Modules.PMs
- {
- class PumpDownRoutine : PMRoutineBase, IRoutine
- {
- private enum PumpStep
- {
- kDelay_2s,
- kCloseISOValve,
- kSoftPump,
- kFastPump,
- kHe2ExDelay,
- kPVHe2,
- kISOValve,
- kTurboN2Purge,
- kVATValve,
- kOpenTurboPumpPurgeGasFinal,
- kOpenTurboPump,
- kGasFinal,
- kFinalStep,
- kCloseValve,
- vFastPump,
- kEnd,
- }
- private enum Kepler2200PumpStep
- {
- kPrepare,
- kCloseISOValve,
- kSoftPump,
- kFastPump,
- kHe2ExDelay,
- kPVHe2,
- kISOValve,
- kTurboN2Purge,
- kVATValve,
- kOpenTurboPumpPurgeGasFinal,
- kOpenTurboPump,
- kGasFinal,
- kFinalStep,
- kCloseValve,
- vFastPump,
- kEnd,
- }
- //private int _ventTime;
- private int _pump_delay = 5000;
- private int _roughPumpPressure = 75000;
- private int _vHe2FlowPressure = 200;
- private int _forelinePressure = 200;
- private int _basePressure = 10;
- private JetChamber jetChamber = JetChamber.None;
- private int _pumpDownLevel;
- //private bool needsoft = true;
- public PumpDownRoutine(JetPMBase chamber) : base(chamber)
- {
- jetChamber = (JetChamber)SC.GetValue<int>($"{chamber.Name}.ChamberType");
- Name = "PumpDown";
- //if (jetChamber == JetChamber.VenusDE)
- //{
- // needsoft = false;
- //}
- }
- public RState Start(params object[] objs)
- {
- if (CheckLid() &&
- CheckSlitDoor())
- {
- Reset();
- _chamber.CloseValves();
- _roughPumpPressure = SC.GetValue<int>($"{Module}.Pump.PumpCrossingPressure");
- _pump_delay = SC.GetValue<int>($"{Module}.Pump.PumpValveDelay") * 1000;
- _basePressure = (objs.Length >= 1) ? Convert.ToInt32(objs[0]) : SC.GetValue<int>($"{Module}.Pump.PumpBasePressure");
- //前端压力值高于某个数值
- _forelinePressure = SC.GetValue<int>($"{Module}.Pump.ForelinePressure");
- if (!_chamber.IsPumpRunning || _chamber.ForelinePressure > _forelinePressure)
- {
- LOG.Write(eEvent.ERR_PM, Module, $"Cannot start pumpdown, drypump running:{_chamber.IsPumpRunning}, ForelinePressure:{_chamber.ForelinePressure}=>Target:{_forelinePressure}");
- return RState.Failed;
- }
- if (_chamber.ChamberType == JetChamber.VenusSE || _chamber.ChamberType == JetChamber.VenusDE)
- {
- _chamber.OpenValve(ValveType.TurboPumpPurge, false);
- _chamber.OpenValve(ValveType.TurboPumpPumping, true);
- _chamber.TurnPendulumValve(false);
- _vHe2FlowPressure = SC.GetValue<int>($"{Module}.Pump.PumpVHe2FlowPressure");
- }
- else
- {
- _vHe2FlowPressure = SC.GetValue<int>($"{Module}.Pump.PumpOpenISOPressure");
- if (_chamber.ChamberPressure > _roughPumpPressure)
- {
- _pumpDownLevel = 0;
- }
- else if (_chamber.ChamberPressure > _vHe2FlowPressure)
- {
- _pumpDownLevel = 1;
- }
- else if (_chamber.ChamberPressure > _basePressure)
- {
- _pumpDownLevel = 2;
- }
- else
- {
- _pumpDownLevel = 3;
- }
- }
- return Runner.Start(Module, Name);
- }
- return RState.Failed;
- }
- public RState Monitor()
- {
- switch (jetChamber)
- {
- case JetChamber.VenusSE:
- Runner.Delay(PumpStep.kDelay_2s, _delay_2s)
- .Run(PumpStep.kCloseISOValve, HOFs.WrapAction(_chamber.OpenValve, ValveType.TurboPumpPumping, false), _delay_2s)
- .Run(PumpStep.kSoftPump, HOFs.WrapAction(_chamber.OpenValve, ValveType.SoftPump, true), CheckToCrossPressure)
- .Run(PumpStep.vFastPump, VenusFastPump, () => { return _chamber.ChamberPressure <= _vHe2FlowPressure; })
- .Delay(PumpStep.kHe2ExDelay, 3000)
- .Run(PumpStep.kPVHe2, OpenHe2Valve, _delay_2s)
- .Run(PumpStep.kISOValve, OpenISOValve, _delay_2s)
- .Run(PumpStep.kVATValve, OpenVATValve, _delay_5s)
- .Run(PumpStep.kOpenTurboPumpPurgeGasFinal, OpenTurboPumpPurgeGasFinalValve, _delay_3s)
- .Run(PumpStep.kFinalStep, FinalStep, () => { return _chamber.ChamberPressure < _basePressure; })
- .Run(PumpStep.kCloseValve, CloseValve, NullFun)
- .End(PumpStep.kEnd, NullFun, _delay_1s);
- break;
- case JetChamber.Kepler2300:
- Runner.Delay(PumpStep.kDelay_2s, _delay_2s)
- .Run(PumpStep.kCloseISOValve, HOFs.WrapAction(_chamber.OpenValve, ValveType.TurboPumpPumping, false), _delay_2s)
- .Run(PumpStep.kSoftPump, HOFs.WrapAction(_chamber.OpenValve, ValveType.SoftPump, true), CheckToCrossPressure)
- .Run(PumpStep.kFastPump, OpenFastPump, () => { return _chamber.ChamberPressure < _vHe2FlowPressure; })
- .Run(PumpStep.kISOValve, OpenKeplerISOValve, _delay_2s)
- .Run(PumpStep.kVATValve, OpenVATValve, VATIsAllOpen, _delay_10s)
- .Run(PumpStep.kOpenTurboPumpPurgeGasFinal, OpenTurboPumpPurgeGasFinalValve, _delay_3s)
- .Run(PumpStep.kFinalStep, FinalStep, () => { return _chamber.ChamberPressure < _basePressure; })
- .End(PumpStep.kEnd, NullFun, _delay_1s);
- break;
- case JetChamber.Kepler2200A:
- case JetChamber.Kepler2200B:
- switch (_pumpDownLevel)
- {
- case 0:
- Runner.Run(Kepler2200PumpStep.kPrepare, CloseVATValve, VATIsAllClose)
- .Run(Kepler2200PumpStep.kCloseISOValve, HOFs.WrapAction(_chamber.OpenValve, ValveType.TurboPumpPumping, false), _delay_2s)
- .Run(Kepler2200PumpStep.kSoftPump, HOFs.WrapAction(_chamber.OpenValve, ValveType.SoftPump, true), CheckToCrossPressure)
- .Run(Kepler2200PumpStep.kFastPump, OpenFastPump, () => { return _chamber.ChamberPressure < _vHe2FlowPressure; })
- .Run(Kepler2200PumpStep.kISOValve, OpenKeplerISOValve, _delay_2s)
- .Run(Kepler2200PumpStep.kVATValve, OpenVATValve, VATIsAllOpen, _delay_10s)
- .Run(Kepler2200PumpStep.kOpenTurboPumpPurgeGasFinal, OpenTurboPumpPurgeGasFinalValve, _delay_1s)
- .Run(Kepler2200PumpStep.kFinalStep, FinalStep, () => { return _chamber.ChamberPressure < _basePressure; })
- .End(Kepler2200PumpStep.kEnd, NullFun, _delay_50ms);
- break;
- case 1:
- Runner
- .Run(Kepler2200PumpStep.kPrepare, CloseVATValve, VATIsAllClose)
- .Run(Kepler2200PumpStep.kCloseISOValve, HOFs.WrapAction(_chamber.OpenValve, ValveType.TurboPumpPumping, false), _delay_2s)
- .Run(Kepler2200PumpStep.kFastPump, OpenFastPump, () => { return _chamber.ChamberPressure < _vHe2FlowPressure; })
- .Run(Kepler2200PumpStep.kISOValve, OpenKeplerISOValve, _delay_2s)
- .Run(Kepler2200PumpStep.kVATValve, OpenVATValve, VATIsAllOpen, _delay_10s)
- .Run(Kepler2200PumpStep.kOpenTurboPumpPurgeGasFinal, OpenTurboPumpPurgeGasFinalValve, _delay_1s)
- .Run(Kepler2200PumpStep.kFinalStep, FinalStep, () => { return _chamber.ChamberPressure < _basePressure; })
- .End(Kepler2200PumpStep.kEnd, NullFun, _delay_50ms);
- break;
- case 2:
- Runner
- .Run(Kepler2200PumpStep.kISOValve, OpenKeplerISOValve)
- .Run(Kepler2200PumpStep.kVATValve, OpenVATValve, VATIsAllOpen, _delay_10s)
- .Run(Kepler2200PumpStep.kOpenTurboPumpPurgeGasFinal, OpenTurboPumpPurgeGasFinalValve)
- .Run(Kepler2200PumpStep.kFinalStep, FinalStep, () => { return _chamber.ChamberPressure < _basePressure; })
- .End(Kepler2200PumpStep.kEnd, NullFun, _delay_50ms);
- break;
- case 3:
- Runner
- .Run(Kepler2200PumpStep.kISOValve, OpenKeplerISOValve)
- .Run(Kepler2200PumpStep.kVATValve, OpenVATValve, VATIsAllOpen, _delay_10s)
- .Run(Kepler2200PumpStep.kOpenTurboPumpPurgeGasFinal, OpenTurboPumpPurgeGasFinalValve)
- .Run(Kepler2200PumpStep.kFinalStep, FinalStep, () => { return _chamber.ChamberPressure < _basePressure; })
- .End(Kepler2200PumpStep.kEnd, NullFun, _delay_50ms);
- break;
- }
- break;
- case JetChamber.VenusDE:
- Runner.Delay(PumpStep.kDelay_2s, _delay_2s)
- .Run(PumpStep.kCloseISOValve, HOFs.WrapAction(_chamber.OpenValve, ValveType.TurboPumpPumping, false), _delay_2s)
- .Run(PumpStep.kFastPump, OpenDEFastPump, VenusFastPumpOver)
- .Delay(PumpStep.kHe2ExDelay, 3000)
- .Run(PumpStep.kPVHe2, OpenHe2w4Valve, _delay_2s)
- .Run(PumpStep.kISOValve, OpenISOValve, _delay_2s)
- .Run(PumpStep.kOpenTurboPump, OpenTurboValve, _delay_3s)
- .Run(PumpStep.kVATValve, OpenVATValve, _delay_2s)
- .Run(PumpStep.kOpenTurboPump, OpenGuageGasFinalValve, _delay_3s)
- .Run(PumpStep.kFinalStep, FinalStep, () => { return _chamber.ChamberPressure < _basePressure; })
- .Run(PumpStep.kCloseValve, CloseValve, NullFun)
- .End(PumpStep.kEnd, NullFun, _delay_1s);
- break;
- }
- return Runner.Status;
- }
- private bool CheckToCrossPressure()
- {
- if (_chamber.ChamberPressure < _roughPumpPressure)
- {
- _chamber.OpenValve(ValveType.SoftPump, false);
- return true;
- }
- else
- return false;
- }
- private bool CloseValve()
- {
- _chamber.OpenValve(ValveType.PVN22, false);
- return true;
- }
- private bool OpenTurboPumpPurgeGasFinalValve()
- {
- _chamber.OpenValve(ValveType.TurboPumpPurge, true);
- _chamber.OpenValve(ValveType.GasFinal, true);
- return true;
- }
- private bool OpenTurboValve()
- {
- _chamber.OpenValve(ValveType.TurboPumpPurge, true);
- return true;
- }
- private bool OpenGuageGasFinalValve()
- {
- _chamber.OpenValve(ValveType.GasFinal, true);
- _chamber.OpenValve(ValveType.Guage, true);
- return true;
- }
- private bool VenusFastPumpOver()
- {
- if (_chamber.ChamberPressure < _vHe2FlowPressure)
- {
- _chamber.OpenValve(ValveType.FastPump, false);
- return true;
- }
- else
- return false;
- }
- private bool VenusFastPump()
- {
- _chamber.OpenValve(ValveType.SoftPump, false);
- if (_chamber.ChamberPressure > _vHe2FlowPressure)
- {
- _chamber.OpenValve(ValveType.FastPump, true);
- }
- return true;
- }
- private bool OpenFastPump()
- {
- _chamber.OpenValve(ValveType.SoftPump, false);
- _chamber.OpenValve(ValveType.FastPump, true);
- return true;
- }
- private bool OpenDEFastPump()
- {
- _chamber.OpenValve(ValveType.PVHe2, false);
- //_chamber.OpenValve(ValveType.SoftPump, false);
- if (_chamber.ChamberPressure > _vHe2FlowPressure)
- {
- _chamber.OpenValve(ValveType.FastPump, true);
- }
- return true;
- }
- private bool OpenHe2Valve()
- {
- _chamber.OpenValve(ValveType.FastPump, false);
- _chamber.OpenValve(ValveType.PVHe2, true);
- return true;
- }
- private bool OpenHe2w4Valve()
- {
- _chamber.OpenValve(ValveType.FastPump, false);
- _chamber.OpenValve(ValveType.PVHe2, true);
- //_chamber.OpenValve(ValveType.PVHe4, true);
- return true;
- }
- private bool OpenISOValve()
- {
- _chamber.OpenValve(ValveType.FastPump, false);
- _chamber.OpenValve(ValveType.PVHe2, false);
- // ISO Valve
- _chamber.OpenValve(ValveType.TurboPumpPumping, true);
- return true;
- }
- private bool OpenKeplerISOValve()
- {
- _chamber.OpenValve(ValveType.FastPump, false);
- // ISO Valve
- _chamber.OpenValve(ValveType.TurboPumpPumping, true);
- return true;
- }
- private bool OpenVATValve()
- {
- return _chamber.TurnPendulumValve(true);
- }
- private bool VATIsAllOpen()
- {
- return _chamber.PendulumPosition > 950;
- }
- private bool CloseVATValve()
- {
- return _chamber.TurnPendulumValve(false);
- }
- private bool VATIsAllClose()
- {
- return _chamber.PendulumPosition < 50;
- }
- //private bool IsNeedSoftPump()
- //{
- // return _chamber.ChamberPressure > _roughPumpPressure;
- //}
- //private bool IsNeedFastPump()
- //{
- // return _chamber.ChamberPressure > _vHe2FlowPressure;
- //}
- //private bool IsNeedCloseVAT()
- //{
- // return _chamber.ChamberPressure > _roughPumpPressure;
- //}
- private bool FinalStep()
- {
- //_chamber.OpenValve(ValveType.Guage, true);
- //2023/04/25修改
- //_chamber.OpenValve(ValveType.TurboPumpPurge, true);
- //_chamber.OpenValve(ValveType.GasFinal, true);
- return true;
- }
- public void Abort()
- {
- CloseAllValves();
- }
- }
- }
|