123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182 |
- using Aitex.Core.RT.Routine;
- using Aitex.Core.RT.SCCore;
- using Venus_RT.Devices;
- using MECF.Framework.Common.Routine;
- using System.Diagnostics;
- using Venus_Core;
- using System;
- using Venus_Unity;
- using MECF.Framework.Common.DBCore;
- namespace Venus_RT.Modules.PMs
- {
- class PMLeakCheckRoutine : PMRoutineBase, IRoutine
- {
- private enum LeakCheckStep
- {
- kPumpToBasePressure,
- kPumpingDelay,
- kLeakCheckDelay,
- kEnd,
- }
- public double LeakRate { get; private set; }
- private int _basePressure = 100;
- private int _leakcheckPumpTime = 180;
- private int _leakcheckHoldTime = 300;
- private double _startPressure = 0;
- private double _endPressure = 0;
- private double _leakRate = 30.0;
- private double _leakCheckBasePressure = 1;
- public string CurrentStep;
- private JetChamber jetChamber = JetChamber.None;
- Stopwatch _leakCheckTimer = new Stopwatch();
- PMLeakCheckResult pMLeakCheckResult;
- Stopwatch _routineTimer = new Stopwatch();
- PressureType _pressureType = PressureType.mTorr;
- public PMLeakCheckRoutine(JetPMBase chamber) : base(chamber)
- {
- jetChamber = (JetChamber)SC.GetValue<int>($"{chamber.Name}.ChamberType");
- Name = "PM Leakcheck";
- if (chamber.ChamberType == JetChamber.Kepler2200A || chamber.ChamberType == JetChamber.Kepler2200B)
- {
- _pressureType = PressureType.Pa;
- }
- }
- public RState Start(params object[] objs)
- {
- if (CheckLid() &&
- CheckSlitDoor() &&
- CheckTurboPump())
- {
- CurrentStep = "Pump To BasePressure";
- Reset();
- _basePressure = SC.GetValue<int>($"{Module}.Pump.PumpBasePressure");
- //_leakcheckPumpTime = SC.GetValue<int>($"{Module}.Pump.LeakCheckPumpingTime");
- //_leakcheckHoldTime = SC.GetValue<int>($"{Module}.Pump.LeakCheckHoldTime");
- //_leakRate = SC.GetValue<double>($"{Module}.Pump.LeakRate");
- _leakcheckPumpTime = (int)(objs[0]);
- _leakcheckHoldTime = (int)(objs[1]);
- _leakRate = (double)(objs[2]);
- _leakCheckBasePressure = SC.GetValue<double>($"{Module}.Pump.LeakCheckBasePressure");
- PreSetValves();
- pMLeakCheckResult = new PMLeakCheckResult();
- pMLeakCheckResult.CheckDate = DateTime.Now.ToString("yyyyMMddHHmm");
- pMLeakCheckResult.CheckMode = "ChamberOnly";
- _routineTimer.Restart();
- return Runner.Start(Module, Name);
- }
- return RState.Failed;
- }
- public RState Monitor()
- {
- Runner.Wait(LeakCheckStep.kPumpToBasePressure, PumpingToBasePressure)
- .Run(LeakCheckStep.kPumpingDelay, StartPumpDelay, PumpingDelay ,1000*60*60*10)
- .Run(LeakCheckStep.kLeakCheckDelay, StartLeakCheck, _leakcheckHoldTime * 1000)
- .End(LeakCheckStep.kEnd, CalcLeakCheckResult, _delay_50ms);
- return Runner.Status;
- }
- public void Abort()
- {
- CloseAllValves();
- }
- private bool PumpingToBasePressure()
- {
- if (_chamber.ProcessPressure <= _basePressure)
- {
- _leakCheckTimer.Restart();
- return true;
- }
- else
- return false;
- }
- private bool PumpingDelay()
- {
- if (_leakCheckTimer.ElapsedMilliseconds >= _leakcheckPumpTime * 1000)
- {
- if (_chamber.ProcessPressure <= _leakCheckBasePressure)
- return true;
- else
- {
- Runner.Stop($"PM Leakcheck失败, 工艺压力 [{_chamber.ProcessPressure}]{_pressureType}, 高于LeakCheck Base Pressure: [{_leakCheckBasePressure}] {_pressureType}");
- }
- }
- return false;
- }
- private bool StartPumpDelay()
- {
- _chamber.OpenValve(ValveType.GasFinal, false);
- CurrentStep = "Check Pump";
- return true;
- }
- private bool StartLeakCheck()
- {
- CurrentStep = "Leak Check";
- _startPressure = _chamber.ProcessPressure;
- pMLeakCheckResult.StartPressure = _startPressure;
- Notify($"PM 压力开始值 {_startPressure} {_pressureType}");
- _chamber.TurnPendulumValve(false);
- return true;
- }
- private bool CalcLeakCheckResult()
- {
- _endPressure = _chamber.ProcessPressure;
- pMLeakCheckResult.EndPressure = _endPressure;
- LeakRate = (_endPressure - _startPressure) * 60.0 / _leakcheckHoldTime;
- pMLeakCheckResult.LeakRate = LeakRate;
- if (LeakRate < _leakRate)
- {
- Notify($"PM Leakcheck完成, 压力结束值: {_startPressure} {_pressureType}, 漏率:{LeakRate} {_pressureType}/min");
- pMLeakCheckResult.Result = "Success";
- }
- else
- {
- Stop($"PM Leakcheck失败, 腔体漏率 [{LeakRate}] {_pressureType}/min, 高于 [{_leakRate}] {_pressureType}/min");
- pMLeakCheckResult.Result = "Fail";
- }
- LeakCheckDataRecorder.Add(_leakcheckHoldTime, Math.Round(_startPressure,1) , Math.Round(_endPressure, 1) , LeakRate, pMLeakCheckResult.Result, "ChamberOnly", _chamber.Name);
- _chamber.OpenValve(ValveType.GasFinal, true);
- _chamber.TurnPendulumValve(true);
- pMLeakCheckResult.LeakCheckTime = (int)_routineTimer.ElapsedMilliseconds / 1000;
- //SerializeHelper.Instance.WriteToJsonFile<PMLeakCheckResult>(pMLeakCheckResult, $"LeakCheck/PM/{DateTime.Now.ToString("yyyyMMddHHmm")}.json");
- return true;
- }
- private void PreSetValves()
- {
- _chamber.OpenValve(ValveType.FastPump, false);
-
-
- if (jetChamber != JetChamber.VenusDE)
- {
- _chamber.OpenValve(ValveType.SoftPump, false);
- }
-
- _chamber.OpenValve(ValveType.TurboPumpPumping, true);
- _chamber.OpenValve(ValveType.Guage, true);
- _chamber.OpenValve(ValveType.GasFinal, true);
- _chamber.TurnPendulumValve(true);
- }
- }
- }
|