瀏覽代碼

Gas Flow and RF Power routine.

# Conflicts:
#	Venus/Venus_RT/Modules/PMs/PMEntity.cs
sangwq 2 年之前
父節點
當前提交
a244b205b9

+ 93 - 0
Venus/Venus_RT/Modules/PMs/GasFlowRoutine.cs

@@ -0,0 +1,93 @@
+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
+{
+    enum GasStep
+    {
+        kStartGas,
+        kEnd,
+    }
+    class GasFlowRoutine : PMRoutineBase, IRoutine
+    {
+        public bool _gasStatus = false;
+        private double[] _mfcSetPoint = new double[8];
+        public GasFlowRoutine(JetPM chamber) : base(chamber)
+        {
+            Name = "Gas Flow";
+        }
+
+        public RState Start(params object[] objs)
+        {
+            if (!_chamber.IsFastPumpOpened)
+            {
+                StopFlow();
+                Stop("Pump 阀没有打开");
+                return RState.Failed;
+            }
+
+            Reset();
+
+
+            // open process final valve and flow
+            Notify("Open valve and flow mfc");
+            _chamber.OpenValve(ValveType.GasFinal, true);
+
+            int i = 0;
+            foreach (object o in objs)
+            {
+                _mfcSetPoint[i++] = (double)o;
+            }
+
+            _gasStatus = true;
+
+            return Runner.Start(Module, Name);
+        }
+        public RState Monitor()
+        {
+            Runner.Run((int)GasStep.kStartGas, FlowMfc, CheckRange, _delay_1s)
+                .End((int)GasStep.kEnd, NullFun, _delay_50ms);
+
+            return Runner.Status;
+        }
+
+        public void Abort()
+        {
+            StopFlow();
+        }
+
+        public bool FlowMfc()
+        {
+            for (int index = 0; index < _mfcSetPoint.Length; index++)
+            {
+                _chamber.FlowGas(index, _mfcSetPoint[index]);
+            }
+
+            return true;
+        }
+
+        private bool CheckRange()
+        {
+            if (_chamber.HasGasOutOfRange)
+            {
+                Stop("流气率越界");
+                _gasStatus = false;
+                return false;
+            }
+
+            return true;
+        }
+
+        public void StopFlow()
+        {
+            Notify("Close valve and stop to flow MFC");
+
+            _chamber.OpenValve(ValveType.GasFinal, false);
+            _chamber.StopAllGases();
+        }
+
+    }
+}

+ 73 - 9
Venus/Venus_RT/Modules/PMs/PMEntity.cs

@@ -122,6 +122,8 @@ namespace Venus_RT.Modules.PMs
         private readonly LLPlaceRoutine             _llPlaceRoutine;
         private readonly LLPickRoutine              _llPickRoutine;
         private readonly PMProcessRoutine           _processRoutine;
+        private readonly GasFlowRoutine             _gasFlowRoutine;
+        private readonly RFPowerSwitchRoutine       _rfPowerRoutine;
 
         public bool IsIdle
         {
@@ -203,6 +205,8 @@ namespace Venus_RT.Modules.PMs
             _llPlaceRoutine         = new LLPlaceRoutine(_chamber);
             _llPickRoutine          = new LLPickRoutine(_chamber, _ventLoadLockRoutine);
             _processRoutine         = new PMProcessRoutine(_chamber, _pumpRoutine);
+            _gasFlowRoutine = new GasFlowRoutine(_chamber);
+            _rfPowerRoutine = new RFPowerSwitchRoutine(_chamber, true);
 
             fsm                     = new StateMachine<PMEntity>(Module.ToString(), (int)PMState.Init, 50);
 
@@ -305,22 +309,25 @@ namespace Venus_RT.Modules.PMs
             Transition(PMState.Processing,      FSM_MSG.TIMER,      FnProcessTimeout,           PMState.Idle);
             Transition(PMState.Processing,      MSG.Abort,          FnAbortProcess,             PMState.Idle);
 
-            //DATA.Subscribe("MyTest", () => { return "123"; });
+            // Gas Flow sequence
+            Transition(PMState.Idle,            MSG.GasFlow,        FnStartGasFlow,             PMState.GasFlowing);
+            Transition(PMState.GasFlowing,      MSG.GasFlow,        FnStartGasFlow,             PMState.GasFlowing);
+            Transition(PMState.GasFlowing,      FSM_MSG.TIMER,      FnGasFlowTimeout,           PMState.Idle);
+            Transition(PMState.GasFlowing,      MSG.StopGasFlow,    FnStopGasFlow,              PMState.Idle);
+            Transition(PMState.GasFlowing,      MSG.Abort,          FnAbortGasFlow,             PMState.Idle);
+
+            //RF Power sequence
+            Transition(PMState.Idle,            MSG.RfPower,        FnStartRfPower,             PMState.RfPowering);
+            Transition(PMState.GasFlowing,      MSG.RfPower,        FnStartRfPower,             PMState.RfPowering);
+            Transition(PMState.RfPowering,      FSM_MSG.TIMER,      FnRfPowerTimeout,           PMState.Idle);
+            Transition(PMState.RfPowering,      MSG.Abort,          FnAbortRfPower,             PMState.Idle);
 
             Running = true;
 
             WaferManager.Instance.SubscribeLocation(ModuleName.PMA, 1);
             WaferManager.Instance.SubscribeLocation(ModuleName.LLA, 1);
         }
-        protected override bool Init()
-        {
-            DATA.Subscribe($"{Module}.FsmState", () => ((PMState)fsm.State).ToString());
 
-            OP.Subscribe($"{Module}.{RtOperation.LeakCheck}", (cmd, args) => CheckToPostMessage((int)MSG.LeakCheck, args));
-            OP.Subscribe($"{Module}.Home", (cmd, args) => CheckToPostMessage((int)MSG.Home));
-            OP.Subscribe($"{Module}.{RtOperation.StartPump}", (cmd, args) => CheckToPostMessage((int)MSG.LaunchPump));
-            return true;
-        }
         private bool FnIdle(object[] objs)
         {
             Running = false;
@@ -335,6 +342,7 @@ namespace Venus_RT.Modules.PMs
         private bool FnError(object[] objs)
         {
             Running = false;
+
             if (((PMState)fsm.State == PMState.Processing) || ((PMState)fsm.State == PMState.PreProcess)
                 || ((PMState)fsm.State == PMState.Homing) || ((PMState)fsm.State == PMState.LoadProcessRecipe))
                 return false;
@@ -343,6 +351,7 @@ namespace Venus_RT.Modules.PMs
             {
                 WaferManager.Instance.UpdateWaferProcessStatus(Module, 0, EnumWaferProcessStatus.Failed);
             }
+
             return true;
         }
 
@@ -745,6 +754,61 @@ namespace Venus_RT.Modules.PMs
             return true;
         }
 
+        private bool FnStartGasFlow(object[] param)
+        {
+            return _gasFlowRoutine.Start(param) == RState.Running;
+        }
+        private bool FnGasFlowTimeout(object[] param)
+        {
+            RState ret = _gasFlowRoutine.Monitor();
+            if (ret == RState.Failed || ret == RState.Timeout)
+            {
+                PostMsg(MSG.Error);
+                return false;
+            }
+
+            return ret == RState.End;
+        }
+
+        private bool FnStopGasFlow(object[] param)
+        {
+            _gasFlowRoutine.Abort();
+            return true;
+        }
+
+        private bool FnAbortGasFlow(object[] param)
+        {
+            _gasFlowRoutine.Abort();
+            return true;
+        }
+
+
+        private bool FnStartRfPower(object[] param)
+        {
+            return _rfPowerRoutine.Start(param) == RState.Running;
+        }
+        private bool FnRfPowerTimeout(object[] param)
+        {
+            RState ret = _rfPowerRoutine.Monitor();
+            if (ret == RState.Failed || ret == RState.Timeout)
+            {
+                PostMsg(MSG.Error);
+                return false;
+            }
+
+            return ret == RState.End;
+        }
+
+        private bool FnAbortRfPower(object[] param)
+        {
+            _rfPowerRoutine.Abort();
+            if(_gasFlowRoutine._gasStatus)
+            {
+                _gasFlowRoutine.StopFlow();
+            }
+            return true;
+        }
+
         private void _debugRoutine()
         {
             int flag = 0;

+ 3 - 1
Venus/Venus_RT/Modules/PMs/PMProcessRoutine.cs

@@ -288,7 +288,9 @@ namespace Venus_RT.Modules.PMs
             }
             else if(result == RState.End)
             {
-                _currentRecipe.Steps[_currentStep].End();
+                if(_currentRecipe.Steps.Count > _currentStep + 1 && _currentRecipe.Steps[_currentStep + 1].Type != StepType.OverEtch)
+                    _currentRecipe.Steps[_currentStep].End();
+
                 if(_currentRecipe.Steps[_currentStep].CycleEnd)
                 {
                     if(_loopCounter > 0)

+ 1 - 0
Venus/Venus_RT/Venus_RT.csproj

@@ -154,6 +154,7 @@
     <Compile Include="Instances\RtInstance.cs" />
     <Compile Include="Instances\ToolLoader.cs" />
     <Compile Include="Modules\PMs\GasBoxLeakCheckRoutine.cs" />
+    <Compile Include="Modules\PMs\GasFlowRoutine.cs" />
     <Compile Include="Modules\PMs\LLPickRoutine.cs" />
     <Compile Include="Modules\PMs\LLPlaceRoutine.cs" />
     <Compile Include="Modules\PMs\LoadLockLeakCheckRoutine.cs" />