Browse Source

Merge branch 'master' of http://git.jetplasma-oa.com/JetPlasma/PunkHPX8

chenkui 23 hours ago
parent
commit
c72a90ab5b

+ 2 - 1
PunkHPX8_Core/RtState.cs

@@ -171,7 +171,8 @@ namespace PunkHPX8_Core
         Idle,
         CCRing,
         RunReciping,
-        Unloading
+        Unloading,
+        Abort
     }
     public enum PlatingCellVerticalState
     {

+ 19 - 2
PunkHPX8_RT/Config/Devices/PowerSupplierCfg-Simulator.xml

@@ -13,7 +13,15 @@
             />
   </PowerSupplierDeviceConfig>
   <PowerSupplierDeviceConfig Name="Power2" IpAddress="127.0.0.1" Port="821" Type="0" SendTimeout="2000" RecvTimeout="2000"> 
-    <Device Name="Power2-1" Address="1"  VoltageUnitSetScale ="1000" UnitSetScale="1000000" UnitScale="1000000" VoltageUnitScale="10000"/>
+    <Device Name="Power2-1" Address="1" 
+			VoltageUnitSetScale ="1000"
+			VoltageUnitScale="100"
+            HighGradeCurrentSetScale="1000" 
+            HighGradeCurrentScale="1000" 
+			MiddleGradeCurrentSetScale="100000"
+			MiddleGradeCurrentScale="100000"
+			LowGradeCurrentSetScale="1000000"
+			LowGradeCurrentScale="1000000"/>
   </PowerSupplierDeviceConfig>
   <PowerSupplierDeviceConfig Name="Power3" IpAddress="127.0.0.1" Port="822" Type="0" SendTimeout="2000" RecvTimeout="2000"> 
     <Device Name="Power3-1" Address="1"  
@@ -28,6 +36,15 @@
             />
   </PowerSupplierDeviceConfig>
   <PowerSupplierDeviceConfig Name="Power4" IpAddress="127.0.0.1" Port="823" Type="0" SendTimeout="2000" RecvTimeout="2000"> 
-    <Device Name="Power4-1" Address="1"  VoltageUnitSetScale ="1000" UnitSetScale="1000" UnitScale="10000" VoltageUnitScale="10000"/>
+    <Device Name="Power4-1" Address="1" 
+			VoltageUnitSetScale ="1000"
+			VoltageUnitScale="100"
+            HighGradeCurrentSetScale="1000" 
+            HighGradeCurrentScale="1000" 
+			MiddleGradeCurrentSetScale="100000"
+			MiddleGradeCurrentScale="100000"
+			LowGradeCurrentSetScale="1000000"
+			LowGradeCurrentScale="1000000"
+	/>
   </PowerSupplierDeviceConfig>
 </PowerSupplierConfig>

+ 5 - 5
PunkHPX8_RT/Devices/AXIS/JetAxisBase.cs

@@ -386,9 +386,9 @@ namespace PunkHPX8_RT.Devices.AXIS
                 _commandMotionData.FileAcceleration = CalculateValueAfterScale(_axisConfig.Acceleration);
                 _commandMotionData.FileDeceleration = CalculateValueAfterScale(_axisConfig.Deceleration);
                 _commandMotionData.HomeOffset = CalculateValueAfterScale(_axisConfig.HomingOffset);
-                _commandMotionData.FileHomingAccel = CalculateValueAfterScale(_axisConfig.HomingAcceleration);
-                _commandMotionData.FileHomingVelocitySlow = CalculateValueAfterScale(_axisConfig.HomingSpeed);
-                _commandMotionData.FileHomingVelocity = CalculateValueAfterScale(_axisConfig.HomingSpeed);
+                _commandMotionData.FileHomingAccel = CalculateValueAfterScale(_axisConfig.HomingAccelDecel);
+                _commandMotionData.FileHomingVelocitySlow = CalculateValueAfterScale(_axisConfig.HomingSpeedEncoderIndex);
+                _commandMotionData.FileHomingVelocity = CalculateValueAfterScale(_axisConfig.HomingSpeedHomeSwitch);
                 _commandMotionData.FileProfileVelocity = CalculateValueAfterScale(_axisConfig.Speed);
                 _commandMotionData.FwdSoftLimit = CalculateValueAfterScale(_axisConfig.ForwardSoftwareLimit)-_commandMotionData.HomeOffset;
                 _commandMotionData.RevSoftLimit = CalculateValueAfterScale(_axisConfig.ReverseSoftwareLimit)-_commandMotionData.HomeOffset;
@@ -491,8 +491,8 @@ namespace PunkHPX8_RT.Devices.AXIS
             }
             checkPosition = checkPosition + offset;
             
-            if(MotionData.MotorPosition < checkPosition + _stationAxis.ToleranceDefault &&
-                MotionData.MotorPosition > checkPosition + _stationAxis.ToleranceDefault)
+            if(MotionData.MotorPosition <= checkPosition + _stationAxis.ToleranceDefault &&
+                MotionData.MotorPosition >= checkPosition - _stationAxis.ToleranceDefault)
             {
                 return true;
             }

+ 22 - 5
PunkHPX8_RT/Modules/PlatingCell/DummyRinseRunRecipeRoutine.cs

@@ -35,7 +35,8 @@ namespace PunkHPX8_RT.Modules.PlatingCell
             WaitRotation,
             IntervalRinseCloseRinseValve,
             //reclaim
-            LoopCheckVerticalRelciamStation,
+            LoopCheckVerticalReclaimStation,
+            ReclaimStartRotation,
             ReclaimChangeRotationSpeed,
             ReclaimRotationDelay,
             //rinse
@@ -151,9 +152,10 @@ namespace PunkHPX8_RT.Modules.PlatingCell
                 .LoopRunIf(RunRecipeStep.IntervalRinseCloseRinseValve, _matchPlatingCellEntity.IsInRecipe && _recipe.RinseBeforeEntryEnable, _device.RinseDisableAction, _delay_1ms)
 
                 //Reclaim
-                .LoopRunIfWithStopStatus(RunRecipeStep.LoopCheckVerticalIntervalRinseStation, _matchPlatingCellEntity.IsInRecipe,
+                .LoopRunIfWithStopStatus(RunRecipeStep.LoopCheckVerticalReclaimStation, _matchPlatingCellEntity.IsInRecipe,
                                () => CheckVerticalInStation("Reclaim", _matchPlatingCellDepDeprecipe.ReclaimZoffset), () => { return _matchPlatingCellEntity.IsError; })
-                .LoopRunIf(RunRecipeStep.ReclaimChangeRotationSpeed, _matchPlatingCellEntity.IsInRecipe , () => { return ChangeRotationSpeed(_recipe.ReclaimSpeed); }, _delay_1ms)
+                .LoopRunIf(RunRecipeStep.ReclaimStartRotation, _matchPlatingCellEntity.IsInRecipe && !_recipe.RinseBeforeEntryEnable, () => { return StartReclaimRotation(LARGETARGETPOSITION); }, _delay_1ms)
+                .LoopRunIf(RunRecipeStep.ReclaimChangeRotationSpeed, _matchPlatingCellEntity.IsInRecipe && _recipe.RinseBeforeEntryEnable, () => { return ChangeRotationSpeed(_recipe.ReclaimSpeed); }, _delay_1ms)
                 .LoopDelayIf(RunRecipeStep.ReclaimRotationDelay, _matchPlatingCellEntity.IsInRecipe , _recipe.ReclaimTime * 1000)
 
                  //Rinse
@@ -201,6 +203,21 @@ namespace PunkHPX8_RT.Modules.PlatingCell
             return true;
         }
         /// <summary>
+        /// rotation开始旋转以Reclaim时的转速
+        /// </summary>
+        /// <param name="param"></param>
+        /// <returns></returns>
+        private bool StartReclaimRotation(int targetPosition)
+        {
+            bool result = _rotationAxis.ProfilePosition(targetPosition, _recipe.ReclaimSpeed * SPEED_RATIO * 6, 0, 0); //rpm->deg/s
+            if (!result)
+            {
+                NotifyError(eEvent.ERR_PLATINGCELL, "Start Rotation is failed", 0);
+                return false;
+            }
+            return true;
+        }
+        /// <summary>
         /// rotation改变速度
         /// </summary>
         /// <param name="speed"></param>
@@ -256,9 +273,9 @@ namespace PunkHPX8_RT.Modules.PlatingCell
                 LOG.WriteLog(eEvent.ERR_METAL, Module, "recipe is null");
                 return RState.Failed;
             }
-            if (objs.Length > 1)
+            if (objs.Length > 2)
             {
-                _cycle = (int)objs[1];
+                _cycle = (int)objs[2];
             }
             _device = DEVICE.GetDevice<PlatingCellDevice>(Module);
             _rotationAxis = DEVICE.GetDevice<JetAxisBase>($"{Module}.Rotation");

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

@@ -91,6 +91,10 @@ namespace PunkHPX8_RT.Modules.PlatingCell
         /// 工艺当前执行小步骤
         /// </summary>
         private string _currentStepState = "Init";
+        /// <summary>
+        /// 当前是否在跑dummy recipe
+        /// </summary>
+        private bool _isCurrentRunDummyRecipe;
         #endregion
 
         #region 属性
@@ -201,6 +205,16 @@ namespace PunkHPX8_RT.Modules.PlatingCell
         /// 当前工步
         /// </summary>
         public string CurrentStepState { get { return _currentStepState; } }
+        /// <summary>
+        /// 是否正在跑dummy recipe
+        /// </summary>
+        public bool IsCurrentRunDummyRecipe
+        {
+            get
+            {
+                return _isCurrentRunDummyRecipe;
+            }
+        }
         #endregion
 
         /// <summary>
@@ -305,6 +319,7 @@ namespace PunkHPX8_RT.Modules.PlatingCell
                 }
                 return CheckToPostMessage<PlatingCellState, PlatingCellMsg>(eEvent.ERR_PREWET, Module.ToString(), (int)PlatingCellMsg.RunRecipe, objects);
             });
+            OP.Subscribe($"{Module}.Abort", (cmd, args) => { return CheckToPostMessage<PlatingCellState, PlatingCellMsg>(eEvent.ERR_RESERVOIR, Module.ToString(), (int)PlatingCellMsg.Abort); });
         }
 
         /// 初始化状态机
@@ -319,6 +334,7 @@ namespace PunkHPX8_RT.Modules.PlatingCell
             Transition(PlatingCellState.Error, PlatingCellMsg.Initialize, InitializeAll, PlatingCellState.Initializing);
             Transition(PlatingCellState.Init, PlatingCellMsg.Initialize, InitializeAll, PlatingCellState.Initializing);
             Transition(PlatingCellState.Idle, PlatingCellMsg.Initialize, InitializeAll, PlatingCellState.Initializing);
+            Transition(PlatingCellState.Abort, PlatingCellMsg.Initialize, InitializeAll, PlatingCellState.Initializing);
             Transition(PlatingCellState.Initializing, FSM_MSG.TIMER, InitializeAllMonitor, PlatingCellState.Idle);
 
             //CCR
@@ -329,6 +345,7 @@ namespace PunkHPX8_RT.Modules.PlatingCell
             Transition(PlatingCellState.Idle, PlatingCellMsg.RunRecipe, CycleManualProcess, PlatingCellState.RunReciping);
             Transition(PlatingCellState.RunReciping, FSM_MSG.TIMER, CycleManualMonitor, PlatingCellState.Idle);
             Transition(PlatingCellState.RunReciping, PlatingCellMsg.Abort, RunRecipeAbort, PlatingCellState.Idle);
+            Transition(PlatingCellState.RunReciping, PlatingCellMsg.Abort, AbortRecipe, PlatingCellState.Abort);
             //Unload
             Transition(PlatingCellState.Idle, PlatingCellMsg.Unload, Unload, PlatingCellState.Unloading);
             Transition(PlatingCellState.Unloading, FSM_MSG.TIMER, UnloadMonitor, PlatingCellState.Idle);
@@ -343,6 +360,25 @@ namespace PunkHPX8_RT.Modules.PlatingCell
             EnumLoop<PlatingCellState>.ForEach((item) => { fsm.MapMessage((int)item, item.ToString()); });
         }
         /// <summary>
+        /// Abort Recipe
+        /// </summary>
+        /// <param name="param"></param>
+        /// <returns></returns>
+        public bool AbortRecipe(object[] param)
+        {
+            //后续还要增加lottrack相关
+            if (!_isCurrentRunDummyRecipe)
+            {
+                _runRecipeRoutine.Abort();
+               
+            }
+            else
+            { 
+                _dummyRinseRunRecipeRoutine.Abort();
+            }
+            return true;
+        }
+        /// <summary>
         /// 手动CCR
         /// </summary>
         /// <returns></returns>
@@ -510,6 +546,7 @@ namespace PunkHPX8_RT.Modules.PlatingCell
             bool _isDummyLoad = (bool)param[1];
             if (!_isDummyLoad)
             {
+                _isCurrentRunDummyRecipe = false;
                 bool result = _runRecipeRoutine.Start(param) == RState.Running;
                 _currentStepState = "";
                 DepRecipe recipe = param[0] as DepRecipe;
@@ -524,6 +561,7 @@ namespace PunkHPX8_RT.Modules.PlatingCell
             }
             else
             {
+                _isCurrentRunDummyRecipe = true;
                 bool result = _dummyRinseRunRecipeRoutine.Start(param) == RState.Running;
                 _currentStepState = "";
                 DqdrRecipe recipe = param[0] as DqdrRecipe;
@@ -543,24 +581,49 @@ namespace PunkHPX8_RT.Modules.PlatingCell
         /// <returns></returns>
         private bool CycleManualMonitor(object[] param)
         {
-            RState state = _runRecipeRoutine.Monitor();
-            _currentStepState = _runRecipeRoutine.CurrentStep;
-            _achievedCycle = _runRecipeRoutine.GetCurrentCycle();
-            //LOG.WriteLog(eEvent.INFO_PLATINGCELL, Module.ToString(), _currentStepState);
-            if (state == RState.Failed || state == RState.Timeout)
+            if (!_isCurrentRunDummyRecipe)
             {
-                PostMsg(PlatingCellMsg.Error);
-                _currentStepState = "";
-                _currentRecipe = null;
-                return false;
+                RState state = _runRecipeRoutine.Monitor();
+                _currentStepState = _runRecipeRoutine.CurrentStep;
+                _achievedCycle = _runRecipeRoutine.GetCurrentCycle();
+                //LOG.WriteLog(eEvent.INFO_PLATINGCELL, Module.ToString(), _currentStepState);
+                if (state == RState.Failed || state == RState.Timeout)
+                {
+                    PostMsg(PlatingCellMsg.Error);
+                    _currentStepState = "";
+                    _currentRecipe = null;
+                    return false;
+                }
+                bool result = state == RState.End;
+                if (result)
+                {
+                    _currentStepState = "";
+                    _currentRecipe = null;
+                }
+                return result;
             }
-            bool result = state == RState.End;
-            if (result)
+            else
             {
-                _currentStepState = "";
-                _currentRecipe = null;
+                RState state = _dummyRinseRunRecipeRoutine.Monitor();
+                _currentStepState = _dummyRinseRunRecipeRoutine.CurrentStep;
+                _achievedCycle = _dummyRinseRunRecipeRoutine.GetCurrentCycle();
+                //LOG.WriteLog(eEvent.INFO_PLATINGCELL, Module.ToString(), _currentStepState);
+                if (state == RState.Failed || state == RState.Timeout)
+                {
+                    PostMsg(PlatingCellMsg.Error);
+                    _currentStepState = "";
+                    _currentRecipe = null;
+                    return false;
+                }
+                bool result = state == RState.End;
+                if (result)
+                {
+                    _currentStepState = "";
+                    _currentRecipe = null;
+                }
+                return result;
             }
-            return result;
+           
         }
         /// <summary>
         /// 中止

+ 11 - 1
PunkHPX8_RT/Modules/PlatingCell/PlatingCellRunRecipeRoutine.cs

@@ -23,6 +23,7 @@ using System.Diagnostics;
 using System.Linq;
 using System.Text;
 using System.Threading.Tasks;
+using System.Windows.Navigation;
 using static Mono.Security.X509.X520;
 
 namespace PunkHPX8_RT.Modules.PlatingCell
@@ -31,6 +32,7 @@ namespace PunkHPX8_RT.Modules.PlatingCell
     {
         private enum RunRecipeStep
         {
+            WaitMatchPlatingCellStart,
             LoopStart,
             InterRinse,
             CheckInterRinse,
@@ -91,6 +93,10 @@ namespace PunkHPX8_RT.Modules.PlatingCell
         /// </summary>
         private PlatingCellEntity _platingCellEntity;
         /// <summary>
+        /// 另一边的platingcell entity
+        /// </summary>
+        private PlatingCellEntity _matchPlatingCellEntity;
+        /// <summary>
         /// 对应reservoir entity
         /// </summary>
         private ReservoirEntity _reservoirEntity;
@@ -190,7 +196,8 @@ namespace PunkHPX8_RT.Modules.PlatingCell
         public RState Monitor()
         {         
                 
-            Runner.LoopStart(RunRecipeStep.LoopStart, "Loop Start Cycle Run Platingcell Recipe Routine", _cycle, NullFun, _delay_1ms)
+            Runner.WaitWithStopCondition(RunRecipeStep.WaitMatchPlatingCellStart,() => { return _matchPlatingCellEntity.IsInRecipe; },() => { return false; }, false,ALL_DAY_MILLOSECONDS)
+                 .LoopStart(RunRecipeStep.LoopStart, "Loop Start Cycle Run Platingcell Recipe Routine", _cycle, NullFun, _delay_1ms)
                 //interval rinse
                 .LoopRunIf(RunRecipeStep.InterRinse, _recipe.RinseBeforeEntryEnable, () => { return _interRinseRoutine.Start(_recipe, LARGETARGETPOSITION) == RState.Running; })
                 .LoopRunIfWithStopStatus(RunRecipeStep.CheckInterRinse, _recipe.RinseBeforeEntryEnable, CheckInterRinseEndStatus,
@@ -334,6 +341,9 @@ namespace PunkHPX8_RT.Modules.PlatingCell
             _reservoirEntity = Singleton<RouteManager>.Instance.GetModule<ReservoirEntity>(reservoir);
             //获取vertical station信息对象
              _verticalBeckhoffStation = BeckhoffStationLocationManager.Instance.GetStationAxis($"{_verticalEntity.Module}", "Vertical");
+            //获取另一边platingcell的entity
+            string MatchModule = ModuleMatcherManager.Instance.GetMatcherByModule(Module);
+            _matchPlatingCellEntity = Singleton<RouteManager>.Instance.GetModule<PlatingCellEntity>(MatchModule);
             if (!CheckPreCondition())
             {
                 return RState.Failed;

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

@@ -119,6 +119,11 @@ namespace PunkHPX8_RT.Modules.PlatingCell
 
             string firstCurrentStep = _cellEntities[0].CurrentStepState;
             string secondCurrentStep = _cellEntities[1].CurrentStepState;
+            if(_cellEntities[0].IsCurrentRunDummyRecipe || _cellEntities[1].IsCurrentRunDummyRecipe)
+            {
+                //其中一个是dummy recipe,直接返回true
+                return true;
+            }
             bool hasDoubleProductionWafer = firstWafer.WaferType == secondWafer.WaferType;
             if (hasDoubleProductionWafer)
             {