using System; using System.Collections.Generic; using System.Reflection; using Aitex.Core.RT.Device; using Aitex.Core.RT.Device.Unit; using Aitex.Core.RT.Log; using Aitex.Core.RT.Routine; using Aitex.Core.RT.SCCore; using Aitex.Core.Util; using MECF.Framework.Common.Equipment; using SicPM.Routines; namespace SicPM.RecipeExecutions { public class PostProcess : PMBaseRoutine { private enum RoutineStep { RotationEnable, HeatEnable, VentPumpClose, ArSupply, OpenH2Valve, SetGroupA, SetGroupB, SetGroupC, SetGroupE, SetGroupF, SetGroupH, SetGroupD, SetGroupG, SetGroupK, SetMFCMode, SetPCMode, SetM1to16, SetPC, SetGroupJ, SetM19to38, SetPC567Close, SetPC567Default, SetPC567Mode, SetGasOut, SetTv, SetM291519to38, SetGasIn1, //V65,V67,V68 OpenFinal1, //V91-96 SetMfcFinal1, //M32-38 SetM291519to26, SetTVCloseMode, SetTvPositionToZero, CheckPM1000, SetGasIn2, SetGroupJOpen, CloseFinal2, OpenFinal2, SetMfcFinal2, WaitPmPressureUp, WaitPmPressureUp1020, SetTvOpen, SetTvMode, SetTVto1050, SetTVto300, WaitTvTo300, CheckPmVac, CheckPmAtm, CheckV72Open, SetV72, SetV76, SetV75, SetEPV1, SetEPV2, SetEPV11, SetEPV22, SetTvModeToPress, SetMfc28to40Special, SetMfc28to40Default, SetPressUpOrDown1, SetPressureDown, EnableRotation, EnableHeater, SetRotation1, SetTC1Mode, SetTC1Ratio, SetTC1Ref, SetTC2Mode, SetTC2Ratio, SetTC2Ref, EnableTC1, EnableTC2, SetFinal1ToDefault, SetFinal1To0, SetFinal2ToDefault, SetFinal2To0, CheckFinal1Open, CheckFinal2Open, CheckTvOpen, SetRotation2, SetGroupV38, TimeDelay0, TimeDelay1, TimeDelay2, TimeDelay3, TimeDelay4, TimeDelay5, TimeDelay6, TimeDelay7, TimeDelay8, TimeDelay9, TimeDelay10, TimeDelay11, TimeDelay12, TimeDelay13, TimeDelay14, TimeDelay15, TimeDelay18, Notify1, Notify2 } private IoThrottleValve2 _IoThrottle; private double _throttleFinalPressure = 300;//蝶阀最终调整对的压力 List _lstPcList = new List { 1, 2, 3, 4, 5, 6, 7 }; private int _mfc1to16RampTime = 30; private int _mfc19to38RampTime = 30; private int _IoValueOpenCloseTimeout = 10; //开关超时时间 private double _pmPressureMaxDiff; //蝶阀与目标压力的差值范围(认为调整到位了) private int _throttleTimeout; //蝶阀调整到指定压力的超时时间 private RecipeHead head; public string RecipeName { get; private set; } public string RecipeContex { get; private set; } private bool _purgeActive; private int _purgeCycleCount; private int _purgeVentTime; private int _purgePumpPressure; private int _purgePumpTimeLimit; private int _purgeVentStableTime; private int _purgePumpStableTime; private int _ventTime; private int _ventTimeLimit; private bool _isOnline; private bool _isVentAfterManualProcess; private IRecipeExecutor _executor; private PMToProcessIdleRoutine _pmToProcessIdleRoutine; public PostProcess(ModuleName module, PMModule pm) : base(module, pm) { Module = module.ToString(); Name = "PostProcess"; //_executor = executor; _pmToProcessIdleRoutine = new PMToProcessIdleRoutine(module, pm); //_ventRoutine = new PMVentRoutine(module, ); } public bool Initialize() { return true; } public void Terminate() { } public override Result Start(params object[] objs) { try { //_IoThrottle = DEVICE.GetDevice($"{Module}.TV"); //_mfc1to16RampTime = SC.GetValue($"PM.{Module}.ProcessIdle.MFC1to16RampTime"); //_mfc19to38RampTime = SC.GetValue($"PM.{Module}.ProcessIdle.MFC19to38RampTime"); //_pmPressureMaxDiff = SC.GetValue($"PM.{Module}.ThrottlePressureMaxDiff"); //_throttleTimeout = SC.GetValue($"PM.{Module}.ThrottlePressureTimeout"); //_throttleFinalPressure = SC.GetValue($"PM.{Module}.ProcessIdle.FinalPressure"); //Reset(); //_purgeCycleCount = (int)SC.GetValue(SCName.ProcessConfig_PurgeCycleCount); //_purgePumpPressure = (int)SC.GetValue(SCName.ProcessConfig_PurgePumpPressure); //_purgeVentTime = (int)SC.GetValue(SCName.ProcessConfig_PurgeVentTime); //_purgePumpTimeLimit = (int)SC.GetValue(SCName.ProcessConfig_PurgePumpTimeLimit); //_purgeVentStableTime = (int)SC.GetValue(SCName.ProcessConfig_PurgeVentStableTime); //_purgePumpStableTime = (int)SC.GetValue(SCName.ProcessConfig_PurgePumpStableTime); //_ventTime = SC.GetValue("PM.VentTime"); //_isOnline = Singleton.Instance.PM.IsOnline; //_isVentAfterManualProcess = SC.GetValue("PM.VentAfterManualProcess"); } catch (Exception ex) { LOG.Write(ex, String.Format("Postprocess Start has exception")); return Result.FAIL; } return Result.RUN; } public override Result Monitor() { try { //SetMfcToDefaultByGroup((int)RoutineStep.SetM1to16, MfcGroupName.M1to16, _mfc1to16RampTime); //TimeDelay((int)RoutineStep.TimeDelay0, _mfc1to16RampTime); //SetPcToDefault((int)RoutineStep.SetPC, _lstPcList); //SetIoValueByGroup((int)RoutineStep.SetGasIn1, IoGroupName.GasIn1, true, _IoValueOpenCloseTimeout); //SetMfcToDefaultByGroup((int)RoutineStep.SetM19to38, MfcGroupName.M19to38, _mfc19to38RampTime); //TimeDelay((int)RoutineStep.TimeDelay1, _mfc19to38RampTime); ////关闭A组,开启B组 //SetIoValueByGroup((int)RoutineStep.ArSupply, IoGroupName.A, true, _IoValueOpenCloseTimeout); //SetIoValueByGroup((int)RoutineStep.SetGroupB, IoGroupName.B, false, _IoValueOpenCloseTimeout); //SetIoValueByGroup((int)RoutineStep.SetGroupC, IoGroupName.C, false, _IoValueOpenCloseTimeout); //SetIoValueByGroup((int)RoutineStep.SetGroupE, IoGroupName.E, false, _IoValueOpenCloseTimeout); //SetIoValueByGroup((int)RoutineStep.SetGroupF, IoGroupName.F, false, _IoValueOpenCloseTimeout); //SetIoValueByGroup((int)RoutineStep.SetGroupH, IoGroupName.H, false, _IoValueOpenCloseTimeout); //SetIoValueByGroup((int)RoutineStep.SetGroupV38, IoGroupName.V38, true, _IoValueOpenCloseTimeout); //SetIoValueByGroup((int)RoutineStep.SetGroupK, IoGroupName.K, false, _IoValueOpenCloseTimeout); //SetPressureUpOrDown((int)RoutineStep.SetPressUpOrDown1, PressureUpOrDown.Dowing); //SetThrottleToTargetAndNoWait((int)RoutineStep.SetPressureDown, _IoThrottle, _throttleFinalPressure); //WaitThrottleToPressureAndSetMfcSpecial((int)RoutineStep.SetTVto300, _IoThrottle, _throttleFinalPressure, _pmPressureMaxDiff, _throttleTimeout); //TimeDelay((int)RoutineStep.TimeDelay7, 10); //ExecuteRoutine((int)RoutineStep.ToProcessIdle, _pmToProcessIdleRoutine); //RFPowerOff((int)RoutineStep.RFPowerOff); //StopAllGasFlow((int)RoutineStep.StopGasFlow, 10); //CloseAllValves((int)RoutineStep.CloseAllValves, 10); //if (_purgeActive) //{ // Loop((int)RoutineStep.Loop, Betone.Preclean.RT.Properties.Resources.CyclePurgeRoutine_Monitor_StartCyclePurge, _purgeCycleCount, Notify, Stop); // CyclePump((int)RoutineStep.Pump, string.Format("Pump to {0} mTorr", _purgePumpPressure), _purgePumpPressure, _purgePumpTimeLimit, Notify, Stop); // CloseValve((int)RoutineStep.ClosePumpValve, string.Format("Pump valve"), DeviceModel.ValveRough, 5, Notify, Stop); // Delay((int)RoutineStep.PumpDelay, string.Format("Pump delay {0} seconds", _purgePumpStableTime), _purgePumpStableTime, Notify, Stop); // CycleVent((int)RoutineStep.Vent, string.Format("Purge {0} senconds", _purgeVentTime), _purgeVentTime, Notify, Stop); // CloseValve((int)RoutineStep.ClosePurgeValve, string.Format("Purge valve"), DeviceModel.ValveVent, 5, Notify, Stop); // Delay((int)RoutineStep.VentDelay, string.Format("Purge delay {0} seconds", _purgeVentStableTime), _purgeVentStableTime, Notify, Stop); // EndLoop((int)RoutineStep.EndLoop, Notify, Stop); //} //else { //ClosePumpingValve((int)RoutineStep.ClosePumpValve, 10); //if (!_isSimulatorMode) // Delay((int)RoutineStep.DelayWaitValve, 3); } //if (!_isATMMode && (_isOnline || _isVentAfterManualProcess)) //{ // //VentToPrecision((int)RoutineStep.VentEndToPrecision, _ventTime); // //ExecuteRoutine((int)RoutineStep.Vent, _ventRoutine); // //CloseVentValves((int)RoutineStep.CloseVentValve, _ventTime); //} //NoteProcessComplete((int)RoutineStep.NoteProcessComplete); //End((int)RoutineStep.End, "PostProcess finished"); } catch (RoutineBreakException) { return Result.RUN; } catch (RoutineFaildException) { //NoteProcessFailed((int)RoutineStep.NoteProcessFailed); return Result.FAIL; } Notify("Finished"); return Result.DONE; } public void Exit() { //_executor.RecipeRunningInfo.RecipeName = string.Empty; //_executor.RecipeRunningInfo.StepName = string.Empty; //_executor.RecipeRunningInfo.Step = 0; //_executor.RecipeRunningInfo.ElapsedTime = 0; //if (DeviceModel.SignalTower != null) //{ // DeviceModel.SignalTower.BuzzerBlinking(SC.GetValue(SCName.System_BuzzerBlinkingTime)); //} //update processing end time //Singleton.Instance.EndRecipeProcess(Singleton.Instance.CurrentRunningJob.RecipeRunId, SusceptorStatus.Processed); } public override void Abort() { PMDevice.AbortRunProcess(out string reason); //.StopAllGasFlow(out string reason); //_pm.SetPowerOnOff(false, out reason); //_pm.SetPower(0, false); //_pm.CloseValvesForPumping(out reason); //_executor.RecipeRunningInfo.RecipeName = string.Empty; //_executor.RecipeRunningInfo.StepName = string.Empty; //_executor.RecipeRunningInfo.Step = 0; //_executor.RecipeRunningInfo.ElapsedTime = 0; } } }