Browse Source

add interval rinse routine

chenzk 2 days ago
parent
commit
fd895d2038

+ 92 - 4
PunkHPX8_RT/Modules/PlatingCell/PlatingCellInterRinseRoutine.cs

@@ -1,6 +1,12 @@
-using Aitex.Core.RT.Routine;
+using Aitex.Core.RT.Log;
+using Aitex.Core.RT.Routine;
+using MECF.Framework.Common.Beckhoff.AxisProvider;
+using MECF.Framework.Common.RecipeCenter;
 using MECF.Framework.Common.Routine;
+using MECF.Framework.Common.Utilities;
 using PunkHPX8_Core;
+using PunkHPX8_RT.Devices.AXIS;
+using PunkHPX8_RT.Devices.PlatingCell;
 using System;
 using System.Collections.Generic;
 using System.Linq;
@@ -13,15 +19,43 @@ namespace PunkHPX8_RT.Modules.PlatingCell
     {
         private enum RunRecipeStep
         {
-            Delay,
+            OpenRinseValve,
+            StartRotation,
+            CheckRotationStop,
+            CloseRinseValve,
             End
         }
+        #region 常量
+        /// <summary>
+        /// ROTATION电机转速比例
+        /// </summary>
+        private const int SPEED_RATIO = 1;
+        #endregion
+
+        /// <summary>
+        /// recipe
+        /// </summary>
+        private DepRecipe _recipe;
+        /// <summary>
+        /// Rotation axis
+        /// </summary>
+        private JetAxisBase _rotationAxis;
+        /// <summary>
+        /// Platingcell device
+        /// </summary>
+        private PlatingCellDevice _device;
+        /// <summary>
+        ///rotation Provider对象
+        /// </summary>
+        private BeckhoffProviderAxis _rotationProviderAxis;
+
         /// <summary>
         /// 构造函数
         /// </summary>
         /// <param name="module"></param>
         public PlatingCellInterRinseRoutine(string module) : base(module)
         {
+
         }
         /// <summary>
         /// 中止
@@ -36,10 +70,60 @@ namespace PunkHPX8_RT.Modules.PlatingCell
         /// <returns></returns>
         public RState Monitor()
         {
-            Runner.Delay(RunRecipeStep.Delay, 5000)
+            Runner.Run(RunRecipeStep.OpenRinseValve, _device.RinseEnableAction, _delay_1ms)
+                .Run(RunRecipeStep.StartRotation, StartRotation, _delay_1ms)
+                .WaitWithStopCondition(RunRecipeStep.CheckRotationStop, CheckRotationEndStatus, CheckRotationStopStatus)
+                .Run(RunRecipeStep.CloseRinseValve, _device.RinseDisableAction, _delay_1ms)
                 .End(RunRecipeStep.End, NullFun);
             return Runner.Status;
         }
+
+        /// <summary>
+        /// rotation开始旋转
+        /// </summary>
+        /// <param name="param"></param>
+        /// <returns></returns>
+        private bool StartRotation()
+        {
+            //比例
+            double _scale = _rotationProviderAxis.ScaleFactor;
+            //rinse 目标位置 
+            double rinsePosition = _recipe.IntervalRinseTime * BeckhoffVelocityUtil.ConvertVelocityToDegPerSecondByRPM(_recipe.IntervalRinseSpeed);
+            int targetPosition = (int)Math.Round((rinsePosition + _recipe.IntervalRinseZoffset) * _scale, 0);
+            bool result = _rotationAxis.ProfilePosition(targetPosition, _recipe.IntervalRinseSpeed * SPEED_RATIO, 0, 0);
+            if (!result)
+            {
+                NotifyError(eEvent.ERR_PLATINGCELL, "Start Rotation is failed", 0);
+                return false;
+            }
+            return true;
+        }
+        /// <summary>
+        /// 检验Rotation是否停止
+        /// </summary>
+        /// <returns></returns>
+        private bool CheckRotationEndStatus()
+        {
+            if (!_rotationAxis.IsRun && _rotationAxis.Status == RState.End)
+            {
+                return true;
+            }
+            return false;
+        }
+        /// <summary>
+        /// 检验Rotation停止状态
+        /// </summary>
+        /// <returns></returns>
+        private bool CheckRotationStopStatus()
+        {
+            if (_rotationAxis.Status == RState.Failed || _rotationAxis.Status == RState.Timeout)
+            {
+                NotifyError(eEvent.ERR_PLATINGCELL, $"{Module}.Rotation is failed", 0);
+                return true;
+            }
+            return false;
+        }
+
         /// <summary>
         /// 启动
         /// </summary>
@@ -47,7 +131,11 @@ namespace PunkHPX8_RT.Modules.PlatingCell
         /// <returns></returns>
         public RState Start(params object[] objs)
         {
-            return Runner.Start(Module, "start inter rinse");
+            _recipe = (DepRecipe)objs[0];
+            _rotationAxis = (JetAxisBase)objs[1];
+            _device = (PlatingCellDevice)objs[2];
+            _rotationProviderAxis = (BeckhoffProviderAxis)objs[3];
+            return Runner.Start(Module, "start intervale rinse");
         }
     }
 }

+ 12 - 4
PunkHPX8_RT/Modules/PlatingCell/PlatingCellRunRecipeRoutine.cs

@@ -5,6 +5,7 @@ using Aitex.Core.Util;
 using MECF.Framework.Common.Beckhoff.AxisProvider;
 using MECF.Framework.Common.RecipeCenter;
 using MECF.Framework.Common.Routine;
+using MECF.Framework.Common.SubstrateTrackings;
 using MECF.Framework.Common.ToolLayout;
 using MECF.Framework.Common.Utilities;
 using PunkHPX8_Core;
@@ -67,7 +68,13 @@ namespace PunkHPX8_RT.Modules.PlatingCell
         /// 对应reservoir entity
         /// </summary>
         private ReservoirEntity _reservoirEntity;
+        /// <summary>
+        /// interbal rinse routien
+        /// </summary>
         private PlatingCellInterRinseRoutine _interRinseRoutine;
+        /// <summary>
+        /// vertical axis entity
+        /// </summary>
         private PlatingCellVerticalEntity _verticalEntity;
         #endregion
         /// <summary>
@@ -92,8 +99,8 @@ namespace PunkHPX8_RT.Modules.PlatingCell
         public RState Monitor()
         {
             Runner.Delay(RunRecipeStep.Delay, 5000)
-                .Run(RunRecipeStep.InterRinse, () => { return _interRinseRoutine.Start() == RState.Running; })
-                .WaitWithStopCondition(RunRecipeStep.CheckInterRinse, CheckInterRinseEndStatus,
+                .RunIf(RunRecipeStep.InterRinse, _recipe.RinseBeforeEntryEnable,() => { return _interRinseRoutine.Start(_recipe,_rotationAxis, _device, _rotationProviderAxis) == RState.Running; })
+                .WaitWithStopConditionIf(RunRecipeStep.CheckInterRinse, _recipe.RinseBeforeEntryEnable,CheckInterRinseEndStatus,
                         () => CommonFunction.CheckRoutineStopState(_interRinseRoutine))
                 .Run(RunRecipeStep.Vertical, StartVertical)
                 .WaitWithStopCondition(RunRecipeStep.CheckVertical, CheckVerticalEnd, CheckVerticalError)
@@ -216,9 +223,10 @@ namespace PunkHPX8_RT.Modules.PlatingCell
                 LOG.WriteLog(eEvent.ERR_PLATINGCELL, Module, $"Releated reseroivr temperature is not reached");
                 return false;
             }
-            if ("Manual".Equals(_reservoirEntity.PersistentValue.OperatingMode))
+            if ("Manual".Equals(_reservoirEntity.PersistentValue.OperatingMode) && !WaferManager.Instance.CheckHasWafer(Module, 0))
             {
-                // 要增加又wafer的判定,待修正
+                LOG.WriteLog(eEvent.ERR_PLATINGCELL, Module, $"Run recipe in manual must has wafer!");
+                return false;
             }
             return true;
         }