Browse Source

add vertical routine into plating cell recipe

chenkui 1 day ago
parent
commit
314d538524

+ 5 - 1
Framework/Common/Routine/RoutineBase.cs

@@ -48,8 +48,12 @@ namespace MECF.Framework.Common.Routine
         /// </summary>
         public string CurrentStep
         {
-            get { return Runner.CurrentStep.ToString();  }
+            get { return $"{Runner.CurrentStep}.{SubRoutineStep}";  }
         }
+        /// <summary>
+        /// 子
+        /// </summary>
+        public string SubRoutineStep { get; set; }
 
 
         public RoutineBase(string module)

+ 34 - 0
PunkHPX8_RT/Modules/ModuleMatcherManager.cs

@@ -27,6 +27,10 @@ namespace PunkHPX8_RT.Modules
             { ModuleName.VPW2.ToString(),ModuleName.VPW1.ToString()},
         };
         private Dictionary<string, string> _platingCellVerticalMatcher = new Dictionary<string, string>();
+        /// <summary>
+        /// 垂直电机Matcher集合字典 
+        /// </summary>
+        private Dictionary<string, List<string>> _verticalMatcherListDic = new Dictionary<string, List<string>>();
         #endregion
         /// <summary>
         /// 获取配对模块
@@ -51,6 +55,20 @@ namespace PunkHPX8_RT.Modules
         public void InitialPlatingCellVerticalID(string platingCellId,string verticalId)
         {
             _platingCellVerticalMatcher[platingCellId] = verticalId;
+            List<string> list = null;
+            if (_verticalMatcherListDic.ContainsKey(verticalId))
+            { 
+                list= _verticalMatcherListDic[verticalId];
+            }
+            else
+            {
+                list = new List<string>();
+                _verticalMatcherListDic[verticalId] = list;
+            }
+            if (!list.Contains(platingCellId))
+            {
+                list.Add(platingCellId);
+            }
         }
         /// <summary>
         /// 获取所有的PlatingCell的垂直电机集合
@@ -76,5 +94,21 @@ namespace PunkHPX8_RT.Modules
                 return "";
             }
         }
+        /// <summary>
+        /// 获取垂直电机的Mathcer集合
+        /// </summary>
+        /// <param name="vertical"></param>
+        /// <returns></returns>
+        public List<string> GetMatcherListByVertical(string vertical)
+        {
+            if (_verticalMatcherListDic.ContainsKey(vertical))
+            {
+                return _verticalMatcherListDic[vertical];
+            }
+            else
+            {
+                return null;
+            }
+        }
     }
 }

+ 14 - 7
PunkHPX8_RT/Modules/PlatingCell/PlatingCellEntity.cs

@@ -86,6 +86,10 @@ namespace PunkHPX8_RT.Modules.PlatingCell
         /// Run recipe routine
         /// </summary>
         private PlatingCellRunRecipeRoutine _runRecipeRoutine;
+        /// <summary>
+        /// 工艺当前执行小步骤
+        /// </summary>
+        private string _currentStepState = "Init";
         #endregion
 
         #region 属性
@@ -175,6 +179,10 @@ namespace PunkHPX8_RT.Modules.PlatingCell
         /// 当前Metal设置的WaferSize
         /// </summary>
         public int MetalWaferSize { get { return _persistentValue.PlatingCellWaferSize; } }
+        /// <summary>
+        /// 当前工步
+        /// </summary>
+        public string CurrentStepState { get { return _currentStepState; } }
         #endregion
 
         /// <summary>
@@ -436,6 +444,7 @@ namespace PunkHPX8_RT.Modules.PlatingCell
         private bool CycleManualProcess(object[] param)
         {
             bool result = _runRecipeRoutine.Start(param) == RState.Running;
+            _currentStepState = "";
             return result;
         }
         /// <summary>
@@ -446,13 +455,17 @@ namespace PunkHPX8_RT.Modules.PlatingCell
         private bool CycleManualMonitor(object[] param)
         {
             RState state = _runRecipeRoutine.Monitor();
+            _currentStepState = _runRecipeRoutine.CurrentStep;
             if (state == RState.Failed || state == RState.Timeout)
             {
+                PostMsg(PlatingCellMsg.Error);
+                _currentStepState = "";
                 return false;
             }
             bool result = state == RState.End;
             if (result)
             {
+                _currentStepState = "";
             }
             return result;
         }
@@ -464,13 +477,7 @@ namespace PunkHPX8_RT.Modules.PlatingCell
         private bool RunRecipeAbort(object[] param)
         {
             _runRecipeRoutine.Abort();
-
-            VpwMainEntity vpwMainEntity = Singleton<RouteManager>.Instance.GetModule<VpwMainEntity>("VPWMain1");
-            if (vpwMainEntity != null)
-            {
-                //把main的状态置为暂停
-                vpwMainEntity.PostMsg(VPWMainMsg.Abort);
-            }
+            _currentStepState = "";
             return true;
         }
         #endregion

+ 53 - 0
PunkHPX8_RT/Modules/PlatingCell/PlatingCellInterRinseRoutine.cs

@@ -0,0 +1,53 @@
+using Aitex.Core.RT.Routine;
+using MECF.Framework.Common.Routine;
+using PunkHPX8_Core;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace PunkHPX8_RT.Modules.PlatingCell
+{
+    public class PlatingCellInterRinseRoutine : RoutineBase, IRoutine
+    {
+        private enum RunRecipeStep
+        {
+            Delay,
+            End
+        }
+        /// <summary>
+        /// 构造函数
+        /// </summary>
+        /// <param name="module"></param>
+        public PlatingCellInterRinseRoutine(string module) : base(module)
+        {
+        }
+        /// <summary>
+        /// 中止
+        /// </summary>
+        public void Abort()
+        {
+            Runner.Stop("Manual Abort");
+        }
+        /// <summary>
+        /// 监控
+        /// </summary>
+        /// <returns></returns>
+        public RState Monitor()
+        {
+            Runner.Delay(RunRecipeStep.Delay, 5000)
+                .End(RunRecipeStep.End, NullFun);
+            return Runner.Status;
+        }
+        /// <summary>
+        /// 启动
+        /// </summary>
+        /// <param name="objs"></param>
+        /// <returns></returns>
+        public RState Start(params object[] objs)
+        {
+            return Runner.Start(Module, "start inter rinse");
+        }
+    }
+}

+ 44 - 0
PunkHPX8_RT/Modules/PlatingCell/PlatingCellRunRecipeRoutine.cs

@@ -1,5 +1,7 @@
 using Aitex.Core.RT.Routine;
+using Aitex.Core.Util;
 using MECF.Framework.Common.Routine;
+using MECF.Framework.Common.Utilities;
 using PunkHPX8_Core;
 using System;
 using System.Collections.Generic;
@@ -14,14 +16,23 @@ namespace PunkHPX8_RT.Modules.PlatingCell
         private enum RunRecipeStep
         {
             Delay,
+            InterRinse,
+            CheckInterRinse,
+            Vertical,
+            CheckVertical,
             End
         }
+        #region 内部变量
+        private PlatingCellInterRinseRoutine _interRinseRoutine;
+        private PlatingCellVerticalEntity _verticalEntity;
+        #endregion
         /// <summary>
         /// 构造函数
         /// </summary>
         /// <param name="module"></param>
         public PlatingCellRunRecipeRoutine(string module) : base(module)
         {
+            _interRinseRoutine=new PlatingCellInterRinseRoutine(module);
         }
         /// <summary>
         /// 中止
@@ -37,16 +48,49 @@ namespace PunkHPX8_RT.Modules.PlatingCell
         public RState Monitor()
         {
             Runner.Delay(RunRecipeStep.Delay, 5000)
+                .Run(RunRecipeStep.InterRinse, () => { return _interRinseRoutine.Start() == RState.Running; })
+                .WaitWithStopCondition(RunRecipeStep.CheckInterRinse,()=>CommonFunction.CheckRoutineEndState(_interRinseRoutine),
+                ()=>CommonFunction.CheckRoutineStopState(_interRinseRoutine))
+                .Run(RunRecipeStep.Vertical,StartVertical)
+                .WaitWithStopCondition(RunRecipeStep.CheckVertical,CheckVerticalEnd,CheckVerticalError)
                 .End(RunRecipeStep.End, NullFun);
             return Runner.Status;
         }
         /// <summary>
+        /// 垂直电机运行(仅示例只做参考)
+        /// </summary>
+        /// <returns></returns>
+        private bool StartVertical()
+        {
+            double position = 101;
+            return _verticalEntity.CheckToPostMessage<PlatingCellVerticalState, VerticalMsg>(Aitex.Core.RT.Log.eEvent.INFO_PLATINGCELL,
+                Module, (int)VerticalMsg.Position, position);
+        }
+        /// <summary>
+        /// 检验垂直电机是否运动完成
+        /// </summary>
+        /// <returns></returns>
+        private bool CheckVerticalEnd()
+        {
+            return _verticalEntity.IsIdle;
+        }
+        /// <summary>
+        /// 检验垂直是否出现错误
+        /// </summary>
+        /// <returns></returns>
+        private bool CheckVerticalError()
+        {
+            return _verticalEntity.IsError;
+        }
+        /// <summary>
         /// 启动
         /// </summary>
         /// <param name="objs"></param>
         /// <returns></returns>
         public RState Start(params object[] objs)
         {
+            string vertical = ModuleMatcherManager.Instance.GetPlatingVerticalByCell(Module);
+            _verticalEntity = Singleton<RouteManager>.Instance.GetModule<PlatingCellVerticalEntity>(vertical);
             return Runner.Start(Module, "Run Recipe");
         }
     }

+ 10 - 9
PunkHPX8_RT/Modules/PlatingCell/PlatingCellVerticalEntity.cs

@@ -18,17 +18,18 @@ using static PunkHPX8_RT.Modules.PlatingCell.PlatingCellEntity;
 
 namespace PunkHPX8_RT.Modules.PlatingCell
 {
+    public enum VerticalMsg
+    {
+        NONE,
+        Error,
+        ResumeError,
+        Initialize,
+        Abort,
+        Init,
+        Position
+    }
     public class PlatingCellVerticalEntity : Entity, IEntity, IModuleEntity
     {
-        public enum VerticalMsg
-        {
-            NONE,
-            Error,
-            ResumeError,
-            Initialize,
-            Abort,
-            Init
-        }
 
         #region 内部变量
         private PlatingCellVerticalInitializeRoutine _initializeRoutine;

+ 191 - 0
PunkHPX8_RT/Modules/PlatingCell/PlatingCellVerticalPositionRoutine.cs

@@ -0,0 +1,191 @@
+using Aitex.Core.RT.Device;
+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 MECF.Framework.Common.Persistent.Reservoirs;
+using MECF.Framework.Common.RecipeCenter;
+using MECF.Framework.Common.Routine;
+using MECF.Framework.Common.SubstrateTrackings;
+using MECF.Framework.Common.ToolLayout;
+using PunkHPX8_Core;
+using PunkHPX8_RT.Devices.AXIS;
+using PunkHPX8_RT.Devices.PlatingCell;
+using PunkHPX8_RT.Devices.Reservoir;
+using System;
+using System.Collections.Generic;
+using System.Diagnostics.Eventing.Reader;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Media.Imaging;
+
+namespace PunkHPX8_RT.Modules.PlatingCell
+{
+    public class PlatingCellVerticalPositionRoutine : RoutineBase, IRoutine
+    {
+        private enum PositionStep
+        {
+            WaitMatcher,
+            GotoPosition,
+            GoToPositionCheck,
+            End
+        }
+
+        #region 内部变量
+        /// <summary>
+        /// vertical axis
+        /// </summary>
+        private JetAxisBase _verticalAxis;
+        /// <summary>
+        ///  matcher集合
+        /// </summary>
+        private List<string> _matcher = new List<string>();
+        /// <summary>
+        /// cell集合
+        /// </summary>
+        private List<PlatingCellEntity> _cellEntities;
+        /// <summary>
+        /// 位置 
+        /// </summary>
+        private double _position;
+
+        private string state;
+        #endregion
+
+        /// <summary>
+        /// 构造函数
+        /// </summary>
+        /// <param name="module"></param>
+        public PlatingCellVerticalPositionRoutine(string module) : base(module)
+        {
+        }
+
+        /// <summary>
+        /// 中止
+        /// </summary>
+        public void Abort()
+        {
+            Runner.Stop("Manual Abort");
+        }
+        /// <summary>
+        /// 监控
+        /// </summary>
+        /// <returns></returns>
+        public RState Monitor()
+        {
+            Runner.Run(PositionStep.GotoPosition, VerticalGotoLoad, 100)
+                .WaitWithStopCondition(PositionStep.GoToPositionCheck, CheckVerticalPositionStatus, CheckVerticalPositionRunStop)
+                .End(PositionStep.End, NullFun, _delay_1ms);
+            return Runner.Status;
+        }
+        /// <summary>
+        /// 检验匹配
+        /// </summary>
+        /// <returns></returns>
+        private bool CheckMatcher()
+        {
+            if (_cellEntities.Count<=1)
+            {
+                return true;
+            }
+            foreach (PlatingCellEntity item in _cellEntities)
+            {
+                if (!WaferManager.Instance.CheckHasWafer(item.Module, 0))
+                {
+                    return false;
+                }
+            }
+
+            string firstCurrentStep = _cellEntities[0].CurrentStepState;
+            foreach (var item in _cellEntities)
+            {
+                if (item.CurrentStepState != firstCurrentStep)
+                {
+                    return false;
+                }
+            }                 
+            return true;
+        }
+        /// <summary>
+        /// vertical 运动到Load位置
+        /// </summary>
+        /// <returns></returns>
+        private bool VerticalGotoLoad()
+        {
+            if(_verticalAxis != null )
+            {
+                if (!_verticalAxis.IsSwitchOn)
+                {
+                    LOG.WriteLog(eEvent.ERR_PLATINGCELL, Module, "Vertical is not Power On");
+                    return false;
+                }
+                else if (!_verticalAxis.IsHomed)
+                {
+                    LOG.WriteLog(eEvent.ERR_PLATINGCELL, Module, "Vertical is not Home,Home vertical first");
+                    return false;
+                }
+                return _verticalAxis.ProfilePositionOperation(_position);
+
+            }
+            else
+            {
+                LOG.WriteLog(eEvent.ERR_PLATINGCELL, Module, "vertical axis is null");
+                return false;
+            }   
+        }
+        /// <summary>
+        /// 检验Vertical移动状态
+        /// </summary>
+        /// <returns></returns>
+        private bool CheckVerticalPositionStatus()
+        {
+            return _verticalAxis.Status == RState.End;
+        }
+        /// <summary>
+        /// 检验Vertical是否还在运动
+        /// </summary>
+        /// <returns></returns>
+        private bool CheckVerticalPositionRunStop()
+        {
+            return _verticalAxis.Status == RState.Failed;
+        }
+        /// <summary>
+        /// 启动
+        /// </summary>
+        /// <param name="objs"></param>
+        /// <returns></returns>
+        public RState Start(params object[] objs)
+        {
+            _position=(double)objs[0];
+            _matcher = ModuleMatcherManager.Instance.GetMatcherListByVertical(Module);
+            foreach (string str in _matcher) 
+            {
+                if(!Enum.TryParse(str, out ModuleName moduleName))
+                {
+                    continue;
+                }
+                if (!ModuleHelper.IsInstalled(moduleName))
+                {
+                    continue;
+                }
+                PlatingCellEntity cellEntity = Singleton<RouteManager>.Instance.GetModule<PlatingCellEntity>(str);
+                if (cellEntity.IsDisable)
+                {
+                    continue;
+                }
+                if (cellEntity.IsError)
+                {
+                    continue;
+                }
+                if (cellEntity.IsAuto)
+                {
+                    _cellEntities.Add(cellEntity);
+                }
+            }
+            _verticalAxis = DEVICE.GetDevice<JetAxisBase>($"{Module}.Vertical");
+            return Runner.Start(Module, "Start PlatingCell Vertical Initialize");
+        }
+    }
+}

+ 2 - 0
PunkHPX8_RT/PunkHPX8_RT.csproj

@@ -299,6 +299,8 @@
     <Compile Include="Modules\ModuleMatcherManager.cs" />
     <Compile Include="Modules\PlatingCell\PlatingCellCCRRoutine.cs" />
     <Compile Include="Modules\PlatingCell\PlatingCellEntity.cs" />
+    <Compile Include="Modules\PlatingCell\PlatingCellInterRinseRoutine.cs" />
+    <Compile Include="Modules\PlatingCell\PlatingCellVerticalPositionRoutine.cs" />
     <Compile Include="Modules\PlatingCell\PlatingCellVerticalInitializeRoutine.cs" />
     <Compile Include="Modules\PlatingCell\PlatingCellInitializeRoutine.cs" />
     <Compile Include="Modules\PlatingCell\PlatingCellRunRecipeRoutine.cs" />