Bläddra i källkod

EFEM place routine add aligner wafersize and distance command

chenkui 2 månader sedan
förälder
incheckning
07fbbfc5ca

+ 9 - 9
CyberX8_RT/Devices/EFEM/SunWayRobot.cs

@@ -543,7 +543,7 @@ namespace CyberX8_RT.Devices.EFEM
             int stationNumber = _moduleStationNumberDictionary[strModuleWaferSize];
             _currentMessage = new EfemMessage()
             {
-                Operation = EfemOperation.Home,
+                Operation = EfemOperation.Map,
                 Module = mod
             };
             string cmd = $"MAP {stationNumber} ARM {_armString[Hand.Blade1]}\r";
@@ -650,15 +650,15 @@ namespace CyberX8_RT.Devices.EFEM
             }
             if (!CheckEfemStatus())
                 return false;
-            if (!WaferManager.Instance.CheckHasWafer(ModuleName.Aligner1, 0))
+            if (!WaferManager.Instance.CheckHasWafer(ModuleName.EfemRobot, 0))
             {
-                LOG.WriteLog(eEvent.ERR_EFEM_COMMON_FAILED, Module.ToString(), $"{ModuleName.Aligner1} has no wafer, Cannot Execute Set aligner wafersize");
+                LOG.WriteLog(eEvent.ERR_EFEM_COMMON_FAILED, Module.ToString(), $"{ModuleName.EfemRobot} has no wafer, Cannot Execute Set aligner wafersize");
                 return false;
             }
-            int waferSize = GetModuleSlotWaferSize(ModuleName.Aligner1, 0);
+            int waferSize = GetModuleSlotWaferSize(ModuleName.EfemRobot, 0);
             if (waferSize == 0)
             {
-                LOG.WriteLog(eEvent.ERR_EFEM_COMMON_FAILED, Module.ToString(), $"{ModuleName.Aligner1} wafer size is 0, Cannot Execute Set aligner wafersize");
+                LOG.WriteLog(eEvent.ERR_EFEM_COMMON_FAILED, Module.ToString(), $"{ModuleName.EfemRobot} wafer size is 0, Cannot Execute Set aligner wafersize");
                 return false;
             }
             //判断socket是否链接
@@ -721,15 +721,15 @@ namespace CyberX8_RT.Devices.EFEM
                 LOG.WriteLog(eEvent.ERROR_EFEM_COMMUNICATION, Module.ToString(), $"Socket is not Conntected");
                 return false;
             }
-            if (!WaferManager.Instance.CheckHasWafer(ModuleName.Aligner1, 0))
+            if (!WaferManager.Instance.CheckHasWafer(ModuleName.EfemRobot, 0))
             {
-                LOG.WriteLog(eEvent.ERR_EFEM_COMMON_FAILED, Module.ToString(), $"{ModuleName.Aligner1} has no wafer, Cannot Execute Set aligner wafersize");
+                LOG.WriteLog(eEvent.ERR_EFEM_COMMON_FAILED, Module.ToString(), $"{ModuleName.EfemRobot} has no wafer, Cannot Execute Set aligner wafersize");
                 return false;
             }
-            int waferSize = GetModuleSlotWaferSize(ModuleName.Aligner1, 0);
+            int waferSize = GetModuleSlotWaferSize(ModuleName.EfemRobot, 0);
             if (waferSize == 0)
             {
-                LOG.WriteLog(eEvent.ERR_EFEM_COMMON_FAILED, Module.ToString(), $"{ModuleName.Aligner1} wafer size is 0, Cannot Execute Set aligner wafersize");
+                LOG.WriteLog(eEvent.ERR_EFEM_COMMON_FAILED, Module.ToString(), $"{ModuleName.EfemRobot} wafer size is 0, Cannot Execute Set aligner wafersize");
                 return false;
             }
             _currentMessage = new EfemMessage()

+ 0 - 18
CyberX8_RT/Modules/EFEM/EFEMAlignRoutine.cs

@@ -18,12 +18,8 @@ namespace CyberX8_RT.Modules.EFEM
         private enum AlignStep
         {
             WaitIdle,
-            SetAlignWaferSize,
-            WaitWaferSizeIdle,
             SetAlignFlatType,
             WaitAlignFlatTypeIdle,
-            SetAlignDistance,
-            WaitAlignDistanceIdle,
             SetAngle,
             ReWaitIdle,
             Rotate,
@@ -89,12 +85,8 @@ namespace CyberX8_RT.Modules.EFEM
         public RState Monitor()
         {
             Runner.Wait(AlignStep.WaitIdle, WaitEFEMIdle)
-                .Run(AlignStep.SetAlignWaferSize, SetAlignerWaferSize,CheckAlignDone,_delay_5s)
-                .Wait(AlignStep.WaitWaferSizeIdle, WaitEFEMIdle)
                 .Run(AlignStep.SetAlignFlatType, SetAlignerFlatType, CheckAlignDone, _delay_5s)
                 .Wait(AlignStep.WaitAlignFlatTypeIdle, WaitEFEMIdle)
-                .Run(AlignStep.SetAlignDistance, SetAlignerDistance, CheckAlignDone, _delay_5s)
-                .Wait(AlignStep.WaitAlignDistanceIdle, WaitEFEMIdle)
                 .Run(AlignStep.SetAngle, SetAlignAngle, CheckAlignDone, _delay_5s)
                 .Wait(AlignStep.ReWaitIdle, WaitEFEMIdle)
                 .Run(AlignStep.Rotate, Align, CheckAlignDone, _moveTimeout)
@@ -104,21 +96,11 @@ namespace CyberX8_RT.Modules.EFEM
             return Runner.Status;
         }
 
-        private bool SetAlignerWaferSize()
-        {
-            return _efem.SetAlignWaferSize();
-        }
-
         private bool SetAlignerFlatType()
         {
             return _efem.SetAlignFlatType(_platType);
         }
 
-        private bool SetAlignerDistance()
-        {
-            return _efem.SetAlignDistance();
-        }
-
         private bool VacuumOff() 
         {
             return _efem.Vacuum(ModuleName.Aligner1, false);

+ 3 - 1
CyberX8_RT/Modules/EFEM/EfemEntity.cs

@@ -334,7 +334,9 @@ namespace CyberX8_RT.Modules
             //OP.Subscribe($"{ModuleName.EfemRobot}.{EfemOperation.Flip}", (cmd, args) => { PostMsg(MSG.Flip, args[0]); return true; });
 
             OP.Subscribe($"{ModuleName.Aligner1}.{EfemOperation.Home}",     (cmd, args) => { PostMsg(MSG.HomeAL, ModuleName.Aligner1); return true; });
-            OP.Subscribe($"{ModuleName.Aligner1}.{EfemOperation.Align}",    (cmd, args) => { CheckToPostMessage<STATE,MSG>(eEvent.ERR_EFEM_COMMON_FAILED,ModuleName.EFEM.ToString(),(int)MSG.Align, ModuleName.Aligner1, args[0], args[1]); return true; });            
+            OP.Subscribe($"{ModuleName.Aligner1}.{EfemOperation.Align}",    (cmd, args) => {
+                int alignerFlatType = SC.GetValue<int>("EFEM.Aligner1.AlignerPlatType");
+                CheckToPostMessage<STATE,MSG>(eEvent.ERR_EFEM_COMMON_FAILED,ModuleName.EFEM.ToString(),(int)MSG.Align, ModuleName.Aligner1, args[0], args[1],alignerFlatType); return true; });            
             //OP.Subscribe($"{ModuleName.Aligner1}.{EfemOperation.Vacuum}",    (cmd, args) => { CheckToPostMessage<STATE,MSG>(eEvent.ERR_EFEM_COMMON_FAILED,ModuleName.EFEM.ToString(),(int)MSG.Vacuum, args); return true; });            
             OP.Subscribe($"{ModuleName.Aligner1}.{EfemOperation.Vacuum}", (cmd, args) => { return VacuumAction(args); });            
             OP.Subscribe($"{Name}.DoorUnlock", (cmd, args) => { return DoorUnlock(args); });

+ 1 - 1
CyberX8_RT/Modules/EFEM/EfemHomeRoutine.cs

@@ -115,7 +115,7 @@ namespace CyberX8_RT.Modules.EFEM
             bool result = vacuumValue < _chuckVacuumIsValid;
             if (!result)
             {
-                LOG.WriteLog(eEvent.ERROR_EFEM_AIR, Module.ToString(), $"Vacumm {vacuumValue} is over {_chuckVacuumIsValid}");
+                LOG.WriteLog(eEvent.ERROR_EFEM_VAC, Module.ToString(), $"Vacumm {vacuumValue} is over {_chuckVacuumIsValid}");
             }
             return result;
         }

+ 106 - 106
CyberX8_RT/Modules/EFEM/EfemMapDummyRoutine.cs

@@ -1,108 +1,108 @@
-using Aitex.Core.Common;
-using MECF.Framework.Common.Equipment;
-using CyberX8_RT.Devices.EFEM;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using Aitex.Core.RT.Log;
-using Aitex.Core.RT.Routine;
-using Aitex.Sorter.Common;
-using MECF.Framework.Common.Schedulers;
-using MECF.Framework.Common.SubstrateTrackings;
-using System.Diagnostics;
-using CyberX8_Core;
-using Aitex.Core.RT.SCCore;
-using System.Threading;
-using Aitex.Core.Util;
-using MECF.Framework.Common.Utilities;
-
-
-namespace CyberX8_RT.Modules.EFEM
-{
-    public class EfemMapDummyRoutine:ModuleRoutineBase, IRoutine
-    {
-        private enum MapDummyStep
-        {
-            MapDummy1,
-            CheckDummy1Map,
-            MapDummy2,
-            CheckDummy2Map,
-            End,
-        }
-        private EfemBase _efem;
+using Aitex.Core.Common;
+using MECF.Framework.Common.Equipment;
+using CyberX8_RT.Devices.EFEM;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Aitex.Core.RT.Log;
+using Aitex.Core.RT.Routine;
+using Aitex.Sorter.Common;
+using MECF.Framework.Common.Schedulers;
+using MECF.Framework.Common.SubstrateTrackings;
+using System.Diagnostics;
+using CyberX8_Core;
+using Aitex.Core.RT.SCCore;
+using System.Threading;
+using Aitex.Core.Util;
+using MECF.Framework.Common.Utilities;
+
+
+namespace CyberX8_RT.Modules.EFEM
+{
+    public class EfemMapDummyRoutine:ModuleRoutineBase, IRoutine
+    {
+        private enum MapDummyStep
+        {
+            MapDummy1,
+            CheckDummy1Map,
+            MapDummy2,
+            CheckDummy2Map,
+            End,
+        }
+        private EfemBase _efem;
         private EfemRobotMapRoutine _robotMapRoutine;
-        bool _isDummy1Install = ModuleHelper.IsInstalled(ModuleName.Dummy1);
-        bool _isDummy2Install = ModuleHelper.IsInstalled(ModuleName.Dummy2);
-        /// <summary>
-        /// 构造函数
-        /// </summary>
-        /// <param name="efem"></param>
-        public EfemMapDummyRoutine(EfemBase efem) : base(ModuleName.EfemRobot)
-        {
-            _efem = efem;
-            _robotMapRoutine=new EfemRobotMapRoutine(efem);
-        }
-        /// <summary>
-        /// 启动
-        /// </summary>
-        /// <param name="objs"></param>
-        /// <returns></returns>
-        public RState Start(params object[] objs)
-        {
-            return Runner.Start(Module, "Map Dummy");
-        }
-        /// <summary>
-        /// 监控
-        /// </summary>
-        /// <returns></returns>
-        public RState Monitor()
-        {
-            Runner.RunIf(MapDummyStep.MapDummy1, CheckDummyAvaible(ModuleName.Dummy1, _isDummy1Install),
-                    () => { return Map(ModuleName.Dummy1);},_delay_1ms)
-                .WaitWithStopConditionIf(MapDummyStep.CheckDummy1Map, CheckDummyAvaible(ModuleName.Dummy1, _isDummy1Install),
-                    () => CommonFunction.CheckRoutineEndState(_robotMapRoutine), () => CommonFunction.CheckRoutineStopState(_robotMapRoutine))
-                .RunIf(MapDummyStep.MapDummy2, CheckDummyAvaible(ModuleName.Dummy2, _isDummy2Install),
-                    () => { return Map(ModuleName.Dummy2); }, _delay_1ms)
-                .WaitWithStopConditionIf(MapDummyStep.CheckDummy2Map, CheckDummyAvaible(ModuleName.Dummy2, _isDummy2Install),
-                    () => CommonFunction.CheckRoutineEndState(_robotMapRoutine), () => CommonFunction.CheckRoutineStopState(_robotMapRoutine))
-                .End(MapDummyStep.End, ActionDone, 0);
-            return Runner.Status;
-        }
-        private bool CheckDummyAvaible(ModuleName moduleName, bool install)
-        {
-            if (!install)
-            {
-                return false;
-            }
-            if (ModuleHelper.IsDummy(moduleName))
-            {
-                DummyDevice dummyDevice = Singleton<RouteManager>.Instance.EFEM.GetDummyDevice(moduleName - ModuleName.Dummy1);
-                if (dummyDevice == null)
-                {
-                    return false;
-                }
-                return dummyDevice.HasCassette;
-            }
-            return false;
-        }
-        /// <summary>
-        /// Map功能
-        /// </summary>
-        /// <returns></returns>
-        private bool Map(ModuleName moduleName)
+        bool _isDummy1Install = ModuleHelper.IsInstalled(ModuleName.Dummy1);
+        bool _isDummy2Install = ModuleHelper.IsInstalled(ModuleName.Dummy2);
+        /// <summary>
+        /// 构造函数
+        /// </summary>
+        /// <param name="efem"></param>
+        public EfemMapDummyRoutine(EfemBase efem) : base(ModuleName.EfemRobot)
+        {
+            _efem = efem;
+            _robotMapRoutine=new EfemRobotMapRoutine(efem);
+        }
+        /// <summary>
+        /// 启动
+        /// </summary>
+        /// <param name="objs"></param>
+        /// <returns></returns>
+        public RState Start(params object[] objs)
+        {
+            return Runner.Start(Module, "Map Dummy");
+        }
+        /// <summary>
+        /// 监控
+        /// </summary>
+        /// <returns></returns>
+        public RState Monitor()
+        {
+            Runner.RunIf(MapDummyStep.MapDummy1, CheckDummyAvaible(ModuleName.Dummy1, _isDummy1Install),
+                    () => { return Map(ModuleName.Dummy1);},_delay_1ms)
+                .WaitWithStopConditionIf(MapDummyStep.CheckDummy1Map, CheckDummyAvaible(ModuleName.Dummy1, _isDummy1Install),
+                    () => CommonFunction.CheckRoutineEndState(_robotMapRoutine), () => CommonFunction.CheckRoutineStopState(_robotMapRoutine))
+                .RunIf(MapDummyStep.MapDummy2, CheckDummyAvaible(ModuleName.Dummy2, _isDummy2Install),
+                    () => { return Map(ModuleName.Dummy2); }, _delay_1ms)
+                .WaitWithStopConditionIf(MapDummyStep.CheckDummy2Map, CheckDummyAvaible(ModuleName.Dummy2, _isDummy2Install),
+                    () => CommonFunction.CheckRoutineEndState(_robotMapRoutine), () => CommonFunction.CheckRoutineStopState(_robotMapRoutine))
+                .End(MapDummyStep.End, ActionDone, 0);
+            return Runner.Status;
+        }
+        private bool CheckDummyAvaible(ModuleName moduleName, bool install)
+        {
+            if (!install)
+            {
+                return false;
+            }
+            if (ModuleHelper.IsDummy(moduleName))
+            {
+                DummyDevice dummyDevice = Singleton<RouteManager>.Instance.EFEM.GetDummyDevice(moduleName - ModuleName.Dummy1);
+                if (dummyDevice == null)
+                {
+                    return false;
+                }
+                return dummyDevice.HasCassette;
+            }
+            return false;
+        }
+        /// <summary>
+        /// Map功能
+        /// </summary>
+        /// <returns></returns>
+        private bool Map(ModuleName moduleName)
+        {
+            return _robotMapRoutine.Start(moduleName) == RState.Running;
+        }
+
+        private bool ActionDone()
+        {
+            return true;
+        }
+
+        public void Abort()
         {
-            return _robotMapRoutine.Start(moduleName) == RState.Running;
-        }
-
-        private bool ActionDone()
-        {
-            return true;
-        }
-
-        public void Abort()
-        {
-        }
-    }
-}
+        }
+    }
+}

+ 297 - 258
CyberX8_RT/Modules/EFEM/EfemPlaceRoutine.cs

@@ -1,69 +1,75 @@
-using Aitex.Core.RT.Routine;
-using Aitex.Core.RT.SCCore;
-using Aitex.Sorter.Common;
-using CyberX8_RT.Devices;
-using MECF.Framework.Common.Routine;
-using MECF.Framework.Common.Equipment;
-using MECF.Framework.Common.SubstrateTrackings;
-using CyberX8_Core;
-using Aitex.Core.RT.Log;
-using Aitex.Core.Util;
-using MECF.Framework.Common.Schedulers;
-using System.Collections.Generic;
-using CyberX8_RT.Devices.EFEM;
-using CyberX8_RT.Modules.SRD;
-using CyberX8_RT.Modules.PUF;
-using CyberX8_RT.Devices.AXIS;
-using Aitex.Core.RT.Device;
-using MECF.Framework.Common.Utilities;
-using System;
-using CyberX8_RT.Modules.LPs;
-
-namespace CyberX8_RT.Modules.EFEM
-{
-    class EfemPlaceRoutine : RoutineBase, IRoutine
-    {
-        private enum PlaceStep
-        {
-            WaitModuleReady,
-            Placing1,
-            Placing2,
-            End,
-        }
-
-        private int _moveTimeout = 20 * 1000;
-        private ModuleName _targetModule = ModuleName.System;
-        int _targetSlot;
-        string _targetPufSlot;
-        int _targetSlot2;
-        Hand _hand;
-        Hand _hand2;
-        EfemBase _efem;
-        bool _bDoublePlace = false;
-        private SRDEntity _srdModule;
-        private PUFEntity _pufModule;
-        private Queue<MoveItem> _moveItems;
-
-        public EfemPlaceRoutine(EfemBase efem) : base(ModuleName.EfemRobot.ToString())
-        {
-            _efem = efem;
-        }
-
-        public RState Start(params object[] objs)
-        {
-            _bDoublePlace = false;
-            _moveItems = (Queue<MoveItem>)objs[0];
-            _targetModule = _moveItems.Peek().DestinationModule;
-            _targetSlot = _moveItems.Peek().DestinationSlot;
-            _hand = _moveItems.Peek().RobotHand;
-
+using Aitex.Core.RT.Routine;
+using Aitex.Core.RT.SCCore;
+using Aitex.Sorter.Common;
+using CyberX8_RT.Devices;
+using MECF.Framework.Common.Routine;
+using MECF.Framework.Common.Equipment;
+using MECF.Framework.Common.SubstrateTrackings;
+using CyberX8_Core;
+using Aitex.Core.RT.Log;
+using Aitex.Core.Util;
+using MECF.Framework.Common.Schedulers;
+using System.Collections.Generic;
+using CyberX8_RT.Devices.EFEM;
+using CyberX8_RT.Modules.SRD;
+using CyberX8_RT.Modules.PUF;
+using CyberX8_RT.Devices.AXIS;
+using Aitex.Core.RT.Device;
+using MECF.Framework.Common.Utilities;
+using System;
+using CyberX8_RT.Modules.LPs;
+
+namespace CyberX8_RT.Modules.EFEM
+{
+    class EfemPlaceRoutine : RoutineBase, IRoutine
+    {
+        private enum PlaceStep
+        {
+            WaitIdle,
+            SetAlignWaferSize,
+            WaitWaferSizeIdle,
+            SetAlignDistance,
+            WaitAlignDistanceIdle,
+            WaitModuleReady,
+            Placing1,
+            Placing2,
+            End,
+        }
+
+        private int _moveTimeout = 20 * 1000;
+        private ModuleName _targetModule = ModuleName.System;
+        int _targetSlot;
+        string _targetPufSlot;
+        int _targetSlot2;
+        Hand _hand;
+        Hand _hand2;
+        EfemBase _efem;
+        bool _bDoublePlace = false;
+        private SRDEntity _srdModule;
+        private PUFEntity _pufModule;
+        private Queue<MoveItem> _moveItems;
+        private bool _isAligner;
+
+        public EfemPlaceRoutine(EfemBase efem) : base(ModuleName.EfemRobot.ToString())
+        {
+            _efem = efem;
+        }
+
+        public RState Start(params object[] objs)
+        {
+            _bDoublePlace = false;
+            _moveItems = (Queue<MoveItem>)objs[0];
+            _targetModule = _moveItems.Peek().DestinationModule;
+            _targetSlot = _moveItems.Peek().DestinationSlot;
+            _hand = _moveItems.Peek().RobotHand;
+
             if (!CheckPreCondition())
             {
                 return RState.Failed;
-            }
-
-            _moveTimeout = SC.GetValue<int>($"EFEM.MotionTimeout") * 1000;
-            return Runner.Start(Module, $"Place to {_targetModule}");
+            }
+            _isAligner = ModuleHelper.IsAligner(_targetModule);
+            _moveTimeout = SC.GetValue<int>($"EFEM.MotionTimeout") * 1000;
+            return Runner.Start(Module, $"Place to {_targetModule}");
         }
 
 
@@ -71,11 +77,11 @@ namespace CyberX8_RT.Modules.EFEM
         {
             LoadPortModule loadPortModule = Singleton<RouteManager>.Instance.EFEM.GetLoadportModule(station - ModuleName.LP1);
             return loadPortModule.LPDevice;
-        }
+        }
         private bool CheckPreCondition()
         {
-            //LoadPort状态判断
-            if (ModuleHelper.IsLoadPort(_targetModule) && ModuleHelper.IsInstalled(_targetModule))
+            //LoadPort状态判断
+            if (ModuleHelper.IsLoadPort(_targetModule) && ModuleHelper.IsInstalled(_targetModule))
             {
                 Loadport loadPort = GetLoadPort(_targetModule);
                 if (loadPort == null)
@@ -86,182 +92,215 @@ namespace CyberX8_RT.Modules.EFEM
                 {
                     NotifyError(eEvent.ERR_EFEM_ROBOT, $"LoadPort not load, cannot do the pick action", -1);
                     return false;
-                }
-            }
-            if (ModuleHelper.IsSRD(_targetModule) && ModuleHelper.IsInstalled(_targetModule))
-            {
-                _srdModule = Singleton<RouteManager>.Instance.GetModule<SRDEntity>(_targetModule.ToString());
-                if (!_srdModule.IsHomed)
-                {
-                    NotifyError(eEvent.ERR_EFEM_ROBOT,  $"{_targetModule} is not homed, please home it first",-1);
-                    return false;
-                }
-                //判断arm是否在home位置上
-                //JetAxisBase jetAxisBase = DEVICE.GetDevice<JetAxisBase>($"{_targetModule}.Arm");
-                //double position = jetAxisBase.MotionData.MotorPosition;
-                //bool result = jetAxisBase.CheckPositionIsInStation(position, "Home");
-                //if (!result)
-                //{
-                //    NotifyError(eEvent.ERR_EFEM_ROBOT,  $"{_targetModule} armaxis {position} is not in homed place",-1);
-                //    return false;
-                //}
-                if (_srdModule.IsSrdDoorClosed)
-                {
-                    NotifyError(eEvent.ERR_EFEM_ROBOT, $"{_targetModule} door closed, can not place",-1);
-                    return false;
-                }
-            }
-            if (ModuleHelper.IsPUF(_targetModule) && ModuleHelper.IsInstalled(_targetModule))
-            {
-                _pufModule = Singleton<RouteManager>.Instance.GetModule<PUFEntity>(_targetModule.ToString());
-                if (!_pufModule.IsHomed)
-                {
-                    NotifyError(eEvent.ERR_EFEM_ROBOT,  $"{_targetModule} is not homed, please home it first",-1);
-                    return false;
-                }
-                if (!_pufModule.IsInRobotStation)
-                {
-                    NotifyError(eEvent.ERR_EFEM_ROBOT, $"{_targetModule} not in robot station, cannot do the place action",-1);
-                    return false;
-                }
-            }
-
-            if (WaferManager.Instance.CheckNoWafer(ModuleName.EfemRobot, (int)_hand))
-            {
-                NotifyError(eEvent.ERR_EFEM_ROBOT, $"Efem robot arm{_hand} already has no wafer, cannot do the place action",-1);
-                return false;
-            }
-
-            if (WaferManager.Instance.CheckHasWafer(_targetModule, _targetSlot))
-            {
-                if (ModuleHelper.IsPUF(_targetModule))
-                {
-                    _targetPufSlot = _targetSlot == 0 ? "SideA" : "SideB";
-                    NotifyError(eEvent.ERR_EFEM_ROBOT, $"The target: {_targetModule}.{_targetPufSlot} has a wafer, cannot do the place action",-1);
-
-                }
-                else
-                {
-                    NotifyError(eEvent.ERR_EFEM_ROBOT, $"The target: {_targetModule}.{_targetSlot + 1} has a wafer, cannot do the place action",-1);
-                }
-                return false;
-            }
-
-            if (_moveItems.Count >= 2)
-            {
-                if (!ModuleHelper.IsLoadPort(_targetModule))
-                {
-                    NotifyError(eEvent.ERR_EFEM_ROBOT,$"Wrong double place command, target is not loadport",-1);
-                    return false;
-                }
-
-                _hand2 = _hand != Hand.Blade1 ? Hand.Blade1 : Hand.Blade2;
-                if (WaferManager.Instance.CheckNoWafer(ModuleName.EfemRobot, (int)_hand2))
-                {
-                    NotifyError(eEvent.ERR_EFEM_ROBOT,$"Efem robot arm{_hand2} has no wafer, cannot do the double place action",-1);
-                    return false;
-                }
-
-                _targetSlot2 = _moveItems.ToArray()[1].DestinationSlot;
-                if (WaferManager.Instance.CheckHasWafer(_targetModule, _targetSlot2))
-                {
-                    NotifyError(eEvent.ERR_EFEM_ROBOT, $"The target: {_targetModule}.{_targetSlot2 + 1} has a wafer, cannot do the double pick action",-1);
-                    return false;
-                }
+                }
+            }
+            if (ModuleHelper.IsSRD(_targetModule) && ModuleHelper.IsInstalled(_targetModule))
+            {
+                _srdModule = Singleton<RouteManager>.Instance.GetModule<SRDEntity>(_targetModule.ToString());
+                if (!_srdModule.IsHomed)
+                {
+                    NotifyError(eEvent.ERR_EFEM_ROBOT,  $"{_targetModule} is not homed, please home it first",-1);
+                    return false;
+                }
+                //判断arm是否在home位置上
+                //JetAxisBase jetAxisBase = DEVICE.GetDevice<JetAxisBase>($"{_targetModule}.Arm");
+                //double position = jetAxisBase.MotionData.MotorPosition;
+                //bool result = jetAxisBase.CheckPositionIsInStation(position, "Home");
+                //if (!result)
+                //{
+                //    NotifyError(eEvent.ERR_EFEM_ROBOT,  $"{_targetModule} armaxis {position} is not in homed place",-1);
+                //    return false;
+                //}
+                if (_srdModule.IsSrdDoorClosed)
+                {
+                    NotifyError(eEvent.ERR_EFEM_ROBOT, $"{_targetModule} door closed, can not place",-1);
+                    return false;
+                }
+            }
+            if (ModuleHelper.IsPUF(_targetModule) && ModuleHelper.IsInstalled(_targetModule))
+            {
+                _pufModule = Singleton<RouteManager>.Instance.GetModule<PUFEntity>(_targetModule.ToString());
+                if (!_pufModule.IsHomed)
+                {
+                    NotifyError(eEvent.ERR_EFEM_ROBOT,  $"{_targetModule} is not homed, please home it first",-1);
+                    return false;
+                }
+                if (!_pufModule.IsInRobotStation)
+                {
+                    NotifyError(eEvent.ERR_EFEM_ROBOT, $"{_targetModule} not in robot station, cannot do the place action",-1);
+                    return false;
+                }
+            }
+
+            if (WaferManager.Instance.CheckNoWafer(ModuleName.EfemRobot, (int)_hand))
+            {
+                NotifyError(eEvent.ERR_EFEM_ROBOT, $"Efem robot arm{_hand} already has no wafer, cannot do the place action",-1);
+                return false;
+            }
+
+            if (WaferManager.Instance.CheckHasWafer(_targetModule, _targetSlot))
+            {
+                if (ModuleHelper.IsPUF(_targetModule))
+                {
+                    _targetPufSlot = _targetSlot == 0 ? "SideA" : "SideB";
+                    NotifyError(eEvent.ERR_EFEM_ROBOT, $"The target: {_targetModule}.{_targetPufSlot} has a wafer, cannot do the place action",-1);
+
+                }
+                else
+                {
+                    NotifyError(eEvent.ERR_EFEM_ROBOT, $"The target: {_targetModule}.{_targetSlot + 1} has a wafer, cannot do the place action",-1);
+                }
+                return false;
+            }
+
+            if (_moveItems.Count >= 2)
+            {
+                if (!ModuleHelper.IsLoadPort(_targetModule))
+                {
+                    NotifyError(eEvent.ERR_EFEM_ROBOT,$"Wrong double place command, target is not loadport",-1);
+                    return false;
+                }
+
+                _hand2 = _hand != Hand.Blade1 ? Hand.Blade1 : Hand.Blade2;
+                if (WaferManager.Instance.CheckNoWafer(ModuleName.EfemRobot, (int)_hand2))
+                {
+                    NotifyError(eEvent.ERR_EFEM_ROBOT,$"Efem robot arm{_hand2} has no wafer, cannot do the double place action",-1);
+                    return false;
+                }
+
+                _targetSlot2 = _moveItems.ToArray()[1].DestinationSlot;
+                if (WaferManager.Instance.CheckHasWafer(_targetModule, _targetSlot2))
+                {
+                    NotifyError(eEvent.ERR_EFEM_ROBOT, $"The target: {_targetModule}.{_targetSlot2 + 1} has a wafer, cannot do the double pick action",-1);
+                    return false;
+                }
             }
             return true;
-        }
-
-        public RState Monitor()
-        {
-            if (_bDoublePlace)
-            {
-                Runner.Wait(PlaceStep.WaitModuleReady,     WaitModuleReady)
-                        .Run(PlaceStep.Placing1,           Place1,         Place1Done,     _moveTimeout)
-                        .Run(PlaceStep.Placing2,           Place2,         Place2Done,     _moveTimeout)
-                        .End(PlaceStep.End,                ActionDone);
-            }
-            else
-            {
-                Runner.Wait(PlaceStep.WaitModuleReady, WaitModuleReady)
-                        .Run(PlaceStep.Placing1,           Place1,         Place1Done,     _moveTimeout)
-                        .End(PlaceStep.End,                ActionDone);
-            }
-
-            return Runner.Status;
-        }
-
-        public void Abort()
-        {
-            _efem.Halt();
-        }
-
-        private bool WaitModuleReady()
-        {
-            return _efem.Status == RState.End;
-        }
-
-        private bool Place1()
-        {
-            return _efem.Place(_targetModule, _targetSlot, _hand);
-        }
-
-        private bool Place1Done()
-        {
-            if (_efem.Status == RState.End)
-            {
-                WaferManager.Instance.WaferMoved(ModuleName.EfemRobot, (int)_hand, _targetModule, _targetSlot);
-                return true;
-            }
-            else if (_efem.Status == RState.Failed)
-            {
-                NotifyError(eEvent.ERR_EFEM_ROBOT, $"Efem robot place failed: {_efem.Status}",-1);
-                return true;
-            }
-
-            return false;
-        }
-
-        private bool Place2()
-        {
-            return _efem.Place(_targetModule, _targetSlot2, _hand2);
-        }
-
-        private bool Place2Done()
-        {
-            if (_efem.Status == RState.End)
-            {
-                WaferManager.Instance.WaferMoved(ModuleName.EfemRobot, (int)_hand2, _targetModule, _targetSlot2);
-                return true;
-            }
-            else if (_efem.Status == RState.Failed)
-            {
-                NotifyError(eEvent.ERR_EFEM_ROBOT, $"Efem robot place failed: {_efem.Status}",-1);
-                return true;
-            }
-
-            return false;
-        }
-
-        private bool ActionDone()
-        {
-            return true;
         }
 
-        /// <summary>
-        /// 重试
-        /// </summary>
-        /// <param name="step"></param>
-        public RState Retry(int step)
-        {
-            if (!CheckPreCondition())
-            {
-                return RState.Failed;
+        public RState Monitor()
+        {
+            if (_bDoublePlace)
+            {
+                Runner.WaitIf(PlaceStep.WaitIdle,_isAligner,WaitModuleReady)
+                    .RunIf(PlaceStep.SetAlignWaferSize,_isAligner,SetAlignerWaferSize, CheckAlignDone, _delay_5s)
+                     .Wait(PlaceStep.WaitWaferSizeIdle, WaitModuleReady)
+                    .RunIf(PlaceStep.SetAlignDistance, _isAligner, SetAlignerDistance,CheckAlignDone, _delay_5s)
+                     .Wait(PlaceStep.WaitAlignDistanceIdle, WaitModuleReady)
+                    .Wait(PlaceStep.WaitModuleReady,     WaitModuleReady)
+                        .Run(PlaceStep.Placing1,           Place1,         Place1Done,     _moveTimeout)
+                        .Run(PlaceStep.Placing2,           Place2,         Place2Done,     _moveTimeout)
+                        .End(PlaceStep.End,                ActionDone);
+            }
+            else
+            {
+                Runner.WaitIf(PlaceStep.WaitIdle, _isAligner, WaitModuleReady)
+                    .RunIf(PlaceStep.SetAlignWaferSize, _isAligner, SetAlignerWaferSize, _delay_1ms)
+                     .Wait(PlaceStep.WaitWaferSizeIdle, WaitModuleReady)
+                    .RunIf(PlaceStep.SetAlignWaferSize, _isAligner, SetAlignerDistance, _delay_1ms)
+                     .Wait(PlaceStep.WaitAlignDistanceIdle, WaitModuleReady)
+                    .Wait(PlaceStep.WaitModuleReady, WaitModuleReady)
+                        .Run(PlaceStep.Placing1,           Place1,         Place1Done,     _moveTimeout)
+                        .End(PlaceStep.End,                ActionDone);
             }
-            _efem.Reset();
-            List<Enum> preStepIds = new List<Enum>();
-            AddPreSteps(PlaceStep.Placing1, preStepIds);
-            return Runner.Retry(PlaceStep.Placing1, preStepIds, Module, "Place Retry");
+
+            return Runner.Status;
+        }
+        private bool SetAlignerWaferSize()
+        {
+            return _efem.SetAlignWaferSize();
+        }
+
+        private bool SetAlignerDistance()
+        {
+            return _efem.SetAlignDistance();
+        }
+
+        public void Abort()
+        {
+            _efem.Halt();
+        }
+
+        private bool WaitModuleReady()
+        {
+            return _efem.Status == RState.End;
+        }
+
+        private bool Place1()
+        {
+            return _efem.Place(_targetModule, _targetSlot, _hand);
+        }
+
+        private bool Place1Done()
+        {
+            if (_efem.Status == RState.End)
+            {
+                WaferManager.Instance.WaferMoved(ModuleName.EfemRobot, (int)_hand, _targetModule, _targetSlot);
+                return true;
+            }
+            else if (_efem.Status == RState.Failed)
+            {
+                NotifyError(eEvent.ERR_EFEM_ROBOT, $"Efem robot place failed: {_efem.Status}",-1);
+                return true;
+            }
+
+            return false;
+        }
+        private bool CheckAlignDone()
+        {
+            if (_efem.Status == RState.End)
+            {
+                return true;
+            }
+            else if (_efem.Status == RState.Failed)
+            {
+                LOG.Write(eEvent.ERR_EFEM_COMMON_FAILED, Module, $"Efem PreAligner align failed: {_efem.Status}");
+                return true;
+            }
+
+            return false;
+        }
+
+        private bool Place2()
+        {
+            return _efem.Place(_targetModule, _targetSlot2, _hand2);
+        }
+
+        private bool Place2Done()
+        {
+            if (_efem.Status == RState.End)
+            {
+                WaferManager.Instance.WaferMoved(ModuleName.EfemRobot, (int)_hand2, _targetModule, _targetSlot2);
+                return true;
+            }
+            else if (_efem.Status == RState.Failed)
+            {
+                NotifyError(eEvent.ERR_EFEM_ROBOT, $"Efem robot place failed: {_efem.Status}",-1);
+                return true;
+            }
+
+            return false;
+        }
+
+        private bool ActionDone()
+        {
+            return true;
+        }
+
+        /// <summary>
+        /// 重试
+        /// </summary>
+        /// <param name="step"></param>
+        public RState Retry(int step)
+        {
+            if (!CheckPreCondition())
+            {
+                return RState.Failed;
+            }
+            _efem.Reset();
+            List<Enum> preStepIds = new List<Enum>();
+            AddPreSteps(PlaceStep.Placing1, preStepIds);
+            return Runner.Retry(PlaceStep.Placing1, preStepIds, Module, "Place Retry");
         }
 
         /// <summary>
@@ -275,24 +314,24 @@ namespace CyberX8_RT.Modules.EFEM
             {
                 preStepIds.Add((PlaceStep)i);
             }
-        }
-        /// <summary>
-        /// 检验前面完成状态
-        /// </summary>
-        /// <returns></returns>
-        public bool CheckCompleteCondition(int index)
-        {
-            if (WaferManager.Instance.CheckHasWafer(ModuleName.EfemRobot, (int)_hand))
-            {
-                NotifyError(eEvent.ERR_EFEM_ROBOT, $"Efem robot arm{_hand} has no wafer", -1);
-                return false;
-            }
-            if (WaferManager.Instance.CheckNoWafer(_targetModule, _targetSlot))
-            {
-                NotifyError(eEvent.ERR_EFEM_ROBOT, $"{_targetModule} Slot{_targetSlot} has no wafer", -1);
-                return false;
-            }
-            return true;
-        }
-    }
-}
+        }
+        /// <summary>
+        /// 检验前面完成状态
+        /// </summary>
+        /// <returns></returns>
+        public bool CheckCompleteCondition(int index)
+        {
+            if (WaferManager.Instance.CheckHasWafer(ModuleName.EfemRobot, (int)_hand))
+            {
+                NotifyError(eEvent.ERR_EFEM_ROBOT, $"Efem robot arm{_hand} has no wafer", -1);
+                return false;
+            }
+            if (WaferManager.Instance.CheckNoWafer(_targetModule, _targetSlot))
+            {
+                NotifyError(eEvent.ERR_EFEM_ROBOT, $"{_targetModule} Slot{_targetSlot} has no wafer", -1);
+                return false;
+            }
+            return true;
+        }
+    }
+}

+ 25 - 4
CyberX8_RT/Modules/PUF/PufSwapRoutine.cs

@@ -21,6 +21,7 @@ using System.Linq;
 using System.Reflection;
 using System.Text;
 using System.Threading.Tasks;
+using Aitex.Core.RT.SCCore;
 
 namespace CyberX8_RT.Modules.PUF
 {
@@ -63,6 +64,7 @@ namespace CyberX8_RT.Modules.PUF
         private PufPlaceToLoaderRoutine _placeToLoaderRoutine;
         private PufChuckRoutine _chuckRoutine;
         private string _loaderSide;
+        private bool _enableCheckStickDistanceStatus = true;
         #endregion
 
         /// <summary>
@@ -172,12 +174,30 @@ namespace CyberX8_RT.Modules.PUF
         /// <returns></returns>
         private bool CheckStickDistanceStatus()
         {
-            bool result= _distanceSensor.CheckStickDistanceStatus();
-            if (!result)
+            if (_enableCheckStickDistanceStatus)
             {
-                NotifyError(eEvent.ERR_PUF, "check stick distance failed", 0);
+                WaferSize waferSize = WaferSize.WS0;
+                WaferInfo waferInfo = WaferManager.Instance.GetWafer(ModuleName.PUF1, 0);
+                if (waferInfo!=null&&!waferInfo.IsEmpty)
+                {
+                    waferSize =waferInfo.Size;
+                }
+                //非8寸的Wafer不检验
+                if (waferSize != WaferSize.WS8)
+                {
+                    return true;
+                }
+                bool result = _distanceSensor.CheckStickDistanceStatus();
+                if (!result)
+                {
+                    NotifyError(eEvent.ERR_PUF, "check stick distance failed", 0);
+                }
+                return result;
+            }
+            else
+            {
+                return true;
             }
-            return result;
         }
         /// <summary>
         /// Axis goto position
@@ -268,6 +288,7 @@ namespace CyberX8_RT.Modules.PUF
             _rotationAxis = DEVICE.GetDevice<JetAxisBase>($"{Module}.Rotation");
             _vacuum = DEVICE.GetDevice<PufVacuum>($"{Module}.Vacuum");
             _distanceSensor = DEVICE.GetDevice<PufDistanceSensor>($"{Module}.DistanceSensor");
+            _enableCheckStickDistanceStatus = SC.GetValue<bool>($"{Module}.EnableCheckStickDistanceStatus");
         }
         /// <summary>
         /// 检验条件

+ 1 - 1
CyberX8_RT/Modules/Reservoir/StandardHotReservoirInitializeRoutine.cs

@@ -115,7 +115,7 @@ namespace CyberX8_RT.Modules.Reservoir
                 .RunIf(InitializeStep.CellPump, !_isRegulatePump,CellsPumpOn, _delay_1ms)
                 .WaitWithStopConditionIf(InitializeStep.WaitCellPump, !_isRegulatePump, CheckPumpOnEndStatus, CheckPumpOnStopStatus)
                 .RunIf(InitializeStep.CellPump, _isRegulatePump, ReservoirPumpOn, _delay_1ms)
-                .WaitIf(InitializeStep.WaitCellPump, _isRegulatePump, CheckRegulatePumpOn,_delay_3m)
+                .WaitIf(InitializeStep.WaitCellPump, _isRegulatePump, CheckRegulatePumpOn,_delay_3s)
                 .DelayIf(InitializeStep.WaitRegulatePumpOn,_isRegulatePump, _cellFlowFaultHoldOffTime)
                 .Run(InitializeStep.CheckCellFlow, CheckCellFlow, _delay_1ms)
                 //Manual cell Bypass同时disable HED

+ 2 - 1
CyberX8_RT/Schedulers/SchedulerSequenceManager.cs

@@ -327,7 +327,8 @@ namespace CyberX8_RT.Schedulers
             SchedulerSequence secondEfemRobotSequence = CreateEfemRobotSequence(moveItem, null,sequenceRecipe.SubstrateSize, ref index);
             schedulerSequences.Add(secondEfemRobotSequence);
             //Aligner
-            SchedulerSequence alignerSequence=CreateAlignerSequence(sequenceRecipe, ref index);
+            SchedulerSequence alignerSequence = alignerSequence=CreateAlignerSequence(sequenceRecipe, ref index);
+
             schedulerSequences.Add(alignerSequence);
             //Aligner至Puf
             MoveItem alignerToPufMoveItem = new MoveItem(ModuleName.Aligner1, 0, pufModule, 1, Aitex.Sorter.Common.Hand.Blade1);

+ 10 - 10
Framework/Common/Log/LOG.cs

@@ -107,7 +107,7 @@ namespace Aitex.Core.RT.Log
             if (logItem != null)
             {
                 var item1 = logItem.Id;
-                var item2 = string.Format(logItem.GlobalDescription_zh, values);
+                var item2 = string.Format(logItem.GlobalDescription_en, values);
                 var item3 = module;
 
                 StringBuilder text = new StringBuilder();
@@ -119,7 +119,7 @@ namespace Aitex.Core.RT.Log
                 text.Append("   ");
                 text.Append(Thread.CurrentThread.ManagedThreadId);
                 text.Append("    ");
-                text.Append(string.Format(logItem.GlobalDescription_zh, values));
+                text.Append(string.Format(logItem.GlobalDescription_en, values));
                 string message = text.ToString();
                 //test += (message + "\r\n");
                 Level level = Level.Undefine;
@@ -151,7 +151,7 @@ namespace Aitex.Core.RT.Log
             if (logItem != null)
             {
                 var item1 = logItem.Id;
-                var item2 = string.Format(logItem.GlobalDescription_zh, values);
+                var item2 = string.Format(logItem.GlobalDescription_en, values);
                 var item3 = module;
 
                 StringBuilder text = new StringBuilder();
@@ -163,7 +163,7 @@ namespace Aitex.Core.RT.Log
                 text.Append("   ");
                 text.Append(Thread.CurrentThread.ManagedThreadId);
                 text.Append("    ");
-                text.Append(string.Format(logItem.GlobalDescription_zh, values));
+                text.Append(string.Format(logItem.GlobalDescription_en, values));
                 string message = text.ToString();
                 //test += (message + "\r\n");
                 Level level = Level.Undefine;
@@ -175,17 +175,17 @@ namespace Aitex.Core.RT.Log
                         Debug(message);
                         break;
                     case Level.Info:
-                        //EV.PostInfoLog(module.ToString(), id, string.Format(((int)item1).ToString().PadRight(6)+ logItem.GlobalDescription_zh, values));
-                        EV.PostInfoLog(module, id, string.Format(logItem.GlobalDescription_zh, values));
+                        //EV.PostInfoLog(module.ToString(), id, string.Format(((int)item1).ToString().PadRight(6)+ logItem.GlobalDescription_en, values));
+                        EV.PostInfoLog(module, id, string.Format(logItem.GlobalDescription_en, values));
 
                         Info(message);
                         break;
                     case Level.Warning:
-                        EV.PostWarningLog(module, id, string.Format(logItem.GlobalDescription_zh, values));
+                        EV.PostWarningLog(module, id, string.Format(logItem.GlobalDescription_en, values));
                         Warning(message);
                         break;
                     case Level.Error:
-                        EV.PostAlarmLog(module, id, string.Format(logItem.GlobalDescription_zh, values));
+                        EV.PostAlarmLog(module, id, string.Format(logItem.GlobalDescription_en, values));
                         Error(message);
                         break;
                     default:
@@ -204,7 +204,7 @@ namespace Aitex.Core.RT.Log
             if (logItem != null)
             {
                 var item1 = logItem.Id;
-                var item2 = string.Format(logItem.GlobalDescription_zh, values);
+                var item2 = string.Format(logItem.GlobalDescription_en, values);
                 var item3 = module;
 
                 StringBuilder text = new StringBuilder();
@@ -216,7 +216,7 @@ namespace Aitex.Core.RT.Log
                 text.Append("   ");
                 text.Append(Thread.CurrentThread.ManagedThreadId);
                 text.Append("    ");
-                text.Append(string.Format(logItem.GlobalDescription_zh, values));
+                text.Append(string.Format(logItem.GlobalDescription_en, values));
                 string message = text.ToString();
                 //test += (message + "\r\n");
                 Level level = Level.Undefine;

+ 1 - 1
Framework/Common/Log/LogManager.cs

@@ -104,7 +104,7 @@ namespace Aitex.Core.RT.Log
                                 File.Delete(info.FullName);
                             }
                         }
-                        if (_isEnableCompressLogFile && lastWriteTime < DateTime.Now.AddDays(-1))
+                        if (_isEnableCompressLogFile && info.Extension != ".zip" && lastWriteTime < DateTime.Now.AddDays(-1))
                         {
                             if (CompressFile(info.FullName, $"{curFolderInfo.FullName}//{info.Name}.zip"))
                             {