Преглед на файлове

revise robotcycle bug,add efem simulator

chenzk преди 1 месец
родител
ревизия
3c848ec44f

+ 1 - 1
CyberX8_MainPages/ViewModels/RobotCycleViewModel.cs

@@ -158,7 +158,7 @@ namespace CyberX8_MainPages.ViewModels
         }
         }
         private void RobotCycleAbortAction(object param)
         private void RobotCycleAbortAction(object param)
         {
         {
-            InvokeClient.Instance.Service.DoOperation($"EFEM.{EfemOperation.Abort}");
+            InvokeClient.Instance.Service.DoOperation($"{ModuleName.EfemRobot}.{EfemOperation.Abort}");
         }
         }
         private void LPChangeAction(object param)
         private void LPChangeAction(object param)
         {
         {

+ 1 - 1
CyberX8_MainPages/Views/EfemView.xaml

@@ -41,7 +41,7 @@
         <TextBlock Text="LP3" Canvas.Top="470" Canvas.Left="350" FontSize="12"></TextBlock>
         <TextBlock Text="LP3" Canvas.Top="470" Canvas.Left="350" FontSize="12"></TextBlock>
 
 
 
 
-        <StackPanel Canvas.Top="70" Canvas.Left="1550">
+        <StackPanel Canvas.Top="15" Canvas.Left="1550">
             <userControls:FOUPFrontView UnitData="{Binding Dummy2ModuleInfo}" ShowTitle="False" IsEnabled="{Binding RtDataValues[System.IsAutoMode],Converter={StaticResource BoolToBool}}"/>
             <userControls:FOUPFrontView UnitData="{Binding Dummy2ModuleInfo}" ShowTitle="False" IsEnabled="{Binding RtDataValues[System.IsAutoMode],Converter={StaticResource BoolToBool}}"/>
             <TextBlock Text="Dummy2" HorizontalAlignment="Center" Margin="0,5,0,20" FontSize="12">
             <TextBlock Text="Dummy2" HorizontalAlignment="Center" Margin="0,5,0,20" FontSize="12">
             </TextBlock>
             </TextBlock>

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

@@ -342,7 +342,7 @@ namespace CyberX8_RT.Modules
             AnyStateTransition(MSG.TurnOffBuzzer,           fnTurnOffBuzzer,    FSM_STATE.SAME);
             AnyStateTransition(MSG.TurnOffBuzzer,           fnTurnOffBuzzer,    FSM_STATE.SAME);
             AnyStateTransition(MSG.Error,                   fnError,            STATE.Error);
             AnyStateTransition(MSG.Error,                   fnError,            STATE.Error);
             AnyStateTransition(MSG.Online,                  fnOnline,           FSM_STATE.SAME);
             AnyStateTransition(MSG.Online,                  fnOnline,           FSM_STATE.SAME);
-            AnyStateTransition(MSG.Abort,                   fnAbortRobot,       FSM_STATE.SAME);
+            //AnyStateTransition(MSG.Abort,                   fnAbortRobot,       FSM_STATE.SAME);
             AnyStateTransition(MSG.ToInit,                  fnToInit,           STATE.Init);
             AnyStateTransition(MSG.ToInit,                  fnToInit,           STATE.Init);
             AnyStateTransition(MSG.BackroundCmd,            fnBackroundCommand, FSM_STATE.SAME);
             AnyStateTransition(MSG.BackroundCmd,            fnBackroundCommand, FSM_STATE.SAME);
             AnyStateTransition(MSG.CloseBuzzer,          fnCloseBuzzer, FSM_STATE.SAME);
             AnyStateTransition(MSG.CloseBuzzer,          fnCloseBuzzer, FSM_STATE.SAME);

+ 52 - 45
CyberX8_RT/Modules/EFEM/RobotCycleRoutine.cs

@@ -80,6 +80,7 @@ namespace CyberX8_RT.Modules.EFEM
         private Queue<int> _lpWaferIndex = new Queue<int>(); //记录有LP有Wafer的slot号
         private Queue<int> _lpWaferIndex = new Queue<int>(); //记录有LP有Wafer的slot号
      
      
         private int _moveTimeout = 20 * 1000;
         private int _moveTimeout = 20 * 1000;
+        private int _dummySlotNumber = 0;
 
 
         public RobotCycleRoutine(EfemBase efem) : base(ModuleName.EfemRobot)
         public RobotCycleRoutine(EfemBase efem) : base(ModuleName.EfemRobot)
         {
         {
@@ -104,7 +105,7 @@ namespace CyberX8_RT.Modules.EFEM
             {
             {
                 return RState.Failed;
                 return RState.Failed;
             }
             }
-            if (!CheckPreCondition())
+            if (!CheckPreCondition()) //检验前提条件
             {
             {
                 return RState.Failed;
                 return RState.Failed;
             }
             }
@@ -171,35 +172,7 @@ namespace CyberX8_RT.Modules.EFEM
 
 
             return Runner.Start(Module, "Robot Cycle start");
             return Runner.Start(Module, "Robot Cycle start");
         }
         }
-        //更新dummy的位置
-        private bool UpdateMoveItem()
-        {
-            if (_lpWaferIndex.Count > 0)
-            {
-                _lpToAlignerMoveItem.Peek().SourceSlot = _lpWaferIndex.Dequeue(); //更新从LP取片的位置
-                if (_targetDummy != ModuleName.Unknown)
-                {
-                    _alignerToDummyMoveItem.Peek().DestinationSlot++; //更新放到Dummy的位置
-                    _dummyToLpMoveItem.Peek().SourceSlot++; //更新从dummy取片的位置,送回LP
-                    _dummyToSrdMoveItem.Peek().SourceSlot++;//更新从dummy取片的位置,送到Srd
-                }
-                _dummyToLpMoveItem.Peek().DestinationSlot = _lpToAlignerMoveItem.Peek().SourceSlot;//更新放回LP的位置。 
-                _srdToLpMoveItem.Peek().DestinationSlot = _lpToAlignerMoveItem.Peek().SourceSlot;//更新放回LP的位置。 
-            }
-            return true;
-        }
-        //清除MoveItem
-        private bool ClearMoveItem()
-        {
-          _lpToAlignerMoveItem.Clear();
-          _alignerToDummyMoveItem.Clear();
-          _alignerToSrdMoveItem.Clear();
-          _dummyToLpMoveItem.Clear();
-          _dummyToSrdMoveItem.Clear();
-          _srdToLpMoveItem.Clear();
-           return true;
-        }
-
+       
         public RState Monitor()
         public RState Monitor()
         {
         {
             Runner.LoopStart(RobotCycleStep.LPCycleStrat, "LP Cycle Start", _waferCount, NullFun, _delay_1ms)
             Runner.LoopStart(RobotCycleStep.LPCycleStrat, "LP Cycle Start", _waferCount, NullFun, _delay_1ms)
@@ -216,6 +189,7 @@ namespace CyberX8_RT.Modules.EFEM
                 .LoopRunWithStopStatus(RobotCycleStep.PickFromAlignerCheck, () => { return CommonFunction.CheckRoutineEndState(_efemPickRoutine); },
                 .LoopRunWithStopStatus(RobotCycleStep.PickFromAlignerCheck, () => { return CommonFunction.CheckRoutineEndState(_efemPickRoutine); },
                  () => CheckRoutineStopStatus(_efemPickRoutine, "Efem pick from aligner failed"))
                  () => CheckRoutineStopStatus(_efemPickRoutine, "Efem pick from aligner failed"))
 
 
+                //从Aligner到dummy
                 .LoopRunIf(RobotCycleStep.PlaceToDummy, _targetDummy != ModuleName.Unknown, () => { return _efemPlaceRoutine.Start(_alignerToDummyMoveItem) == RState.Running; }, _delay_1ms)
                 .LoopRunIf(RobotCycleStep.PlaceToDummy, _targetDummy != ModuleName.Unknown, () => { return _efemPlaceRoutine.Start(_alignerToDummyMoveItem) == RState.Running; }, _delay_1ms)
                 .LoopRunIfWithStopStatus(RobotCycleStep.PlaceToDummyCheck, _targetDummy != ModuleName.Unknown,() => { return CommonFunction.CheckRoutineEndState(_efemPlaceRoutine); },
                 .LoopRunIfWithStopStatus(RobotCycleStep.PlaceToDummyCheck, _targetDummy != ModuleName.Unknown,() => { return CommonFunction.CheckRoutineEndState(_efemPlaceRoutine); },
                  () => CheckRoutineStopStatus(_efemPlaceRoutine, "Efem place to dummy failed"))
                  () => CheckRoutineStopStatus(_efemPlaceRoutine, "Efem place to dummy failed"))
@@ -224,22 +198,22 @@ namespace CyberX8_RT.Modules.EFEM
                 .LoopRunIfWithStopStatus(RobotCycleStep.PickFromDummyCheck, _targetDummy != ModuleName.Unknown,() => { return CommonFunction.CheckRoutineEndState(_efemPickRoutine); },
                 .LoopRunIfWithStopStatus(RobotCycleStep.PickFromDummyCheck, _targetDummy != ModuleName.Unknown,() => { return CommonFunction.CheckRoutineEndState(_efemPickRoutine); },
                  () => CheckRoutineStopStatus(_efemPickRoutine, "Efem pick from dummy failed"))
                  () => CheckRoutineStopStatus(_efemPickRoutine, "Efem pick from dummy failed"))
 
 
-                //从Dummy到SRD的
-                .LoopRunIf(RobotCycleStep.PlaceToSrd, _targetSrd != ModuleName.Unknown && _targetDummy!=ModuleName.Unknown, () => { return _efemPlaceRoutine.Start(_alignerToSrdMoveItem) == RState.Running; }, _delay_1ms)
-                .LoopRunIfWithStopStatus(RobotCycleStep.PlaceToSrdCheck, _targetSrd != ModuleName.Unknown && _targetDummy != ModuleName.Unknown, () => { return CommonFunction.CheckRoutineEndState(_efemPlaceRoutine); },
-                 () => CheckRoutineStopStatus(_efemPlaceRoutine, "Efem place to srd failed"))
-                .LoopRunIf(RobotCycleStep.PickFromSrd, _targetSrd != ModuleName.Unknown && _targetDummy != ModuleName.Unknown, () => { return _efemPickRoutine.Start(_alignerToSrdMoveItem) == RState.Running; }, _delay_1ms)
-                .LoopRunIfWithStopStatus(RobotCycleStep.PickFromSrdCheck, _targetSrd != ModuleName.Unknown && _targetDummy != ModuleName.Unknown, () => { return CommonFunction.CheckRoutineEndState(_efemPickRoutine); },
-                 () => CheckRoutineStopStatus(_efemPickRoutine, "Efem pick from srd failed"))
-
                 //从Aligner到SRD的
                 //从Aligner到SRD的
-                .LoopRunIf(RobotCycleStep.PlaceToSrd, _targetSrd != ModuleName.Unknown && _targetDummy == ModuleName.Unknown, () => { return _efemPlaceRoutine.Start(_dummyToSrdMoveItem) == RState.Running; }, _delay_1ms)
+                .LoopRunIf(RobotCycleStep.PlaceToSrd, _targetSrd != ModuleName.Unknown && _targetDummy==ModuleName.Unknown, () => { return _efemPlaceRoutine.Start(_alignerToSrdMoveItem) == RState.Running; }, _delay_1ms)
                 .LoopRunIfWithStopStatus(RobotCycleStep.PlaceToSrdCheck, _targetSrd != ModuleName.Unknown && _targetDummy == ModuleName.Unknown, () => { return CommonFunction.CheckRoutineEndState(_efemPlaceRoutine); },
                 .LoopRunIfWithStopStatus(RobotCycleStep.PlaceToSrdCheck, _targetSrd != ModuleName.Unknown && _targetDummy == ModuleName.Unknown, () => { return CommonFunction.CheckRoutineEndState(_efemPlaceRoutine); },
                  () => CheckRoutineStopStatus(_efemPlaceRoutine, "Efem place to srd failed"))
                  () => CheckRoutineStopStatus(_efemPlaceRoutine, "Efem place to srd failed"))
-                .LoopRunIf(RobotCycleStep.PickFromSrd, _targetSrd != ModuleName.Unknown && _targetDummy == ModuleName.Unknown, () => { return _efemPickRoutine.Start(_dummyToSrdMoveItem) == RState.Running; }, _delay_1ms)
+                .LoopRunIf(RobotCycleStep.PickFromSrd, _targetSrd != ModuleName.Unknown && _targetDummy == ModuleName.Unknown, () => { return _efemPickRoutine.Start(_alignerToSrdMoveItem) == RState.Running; }, _delay_1ms)
                 .LoopRunIfWithStopStatus(RobotCycleStep.PickFromSrdCheck, _targetSrd != ModuleName.Unknown && _targetDummy == ModuleName.Unknown, () => { return CommonFunction.CheckRoutineEndState(_efemPickRoutine); },
                 .LoopRunIfWithStopStatus(RobotCycleStep.PickFromSrdCheck, _targetSrd != ModuleName.Unknown && _targetDummy == ModuleName.Unknown, () => { return CommonFunction.CheckRoutineEndState(_efemPickRoutine); },
                  () => CheckRoutineStopStatus(_efemPickRoutine, "Efem pick from srd failed"))
                  () => CheckRoutineStopStatus(_efemPickRoutine, "Efem pick from srd failed"))
 
 
+                //从dummy到SRD的
+                .LoopRunIf(RobotCycleStep.PlaceToSrd, _targetSrd != ModuleName.Unknown && _targetDummy != ModuleName.Unknown, () => { return _efemPlaceRoutine.Start(_dummyToSrdMoveItem) == RState.Running; }, _delay_1ms)
+                .LoopRunIfWithStopStatus(RobotCycleStep.PlaceToSrdCheck, _targetSrd != ModuleName.Unknown && _targetDummy != ModuleName.Unknown, () => { return CommonFunction.CheckRoutineEndState(_efemPlaceRoutine); },
+                 () => CheckRoutineStopStatus(_efemPlaceRoutine, "Efem place to srd failed"))
+                .LoopRunIf(RobotCycleStep.PickFromSrd, _targetSrd != ModuleName.Unknown && _targetDummy != ModuleName.Unknown, () => { return _efemPickRoutine.Start(_dummyToSrdMoveItem) == RState.Running; }, _delay_1ms)
+                .LoopRunIfWithStopStatus(RobotCycleStep.PickFromSrdCheck, _targetSrd != ModuleName.Unknown && _targetDummy != ModuleName.Unknown, () => { return CommonFunction.CheckRoutineEndState(_efemPickRoutine); },
+                 () => CheckRoutineStopStatus(_efemPickRoutine, "Efem pick from srd failed"))
+
                 //从Dummy回LP
                 //从Dummy回LP
                 .LoopRunIf(RobotCycleStep.PlaceToLP, _targetDummy != ModuleName.Unknown && _targetSrd == ModuleName.Unknown, () => { return _efemPlaceRoutine.Start(_dummyToLpMoveItem) == RState.Running; }, _delay_1ms)
                 .LoopRunIf(RobotCycleStep.PlaceToLP, _targetDummy != ModuleName.Unknown && _targetSrd == ModuleName.Unknown, () => { return _efemPlaceRoutine.Start(_dummyToLpMoveItem) == RState.Running; }, _delay_1ms)
                 .LoopRunIfWithStopStatus(RobotCycleStep.PlaceToLPCheck, _targetDummy != ModuleName.Unknown && _targetSrd == ModuleName.Unknown, () => { return CommonFunction.CheckRoutineEndState(_efemPlaceRoutine); },
                 .LoopRunIfWithStopStatus(RobotCycleStep.PlaceToLPCheck, _targetDummy != ModuleName.Unknown && _targetSrd == ModuleName.Unknown, () => { return CommonFunction.CheckRoutineEndState(_efemPlaceRoutine); },
@@ -321,14 +295,19 @@ namespace CyberX8_RT.Modules.EFEM
                     Stop($"{_targetDummy} dose not have cassette");
                     Stop($"{_targetDummy} dose not have cassette");
                 }
                 }
                 WaferInfo[] waferInfos = WaferManager.Instance.GetWafers(_targetDummy);
                 WaferInfo[] waferInfos = WaferManager.Instance.GetWafers(_targetDummy);
-                foreach (var item in waferInfos)
+                if(waferInfos.Length > 0)
                 {
                 {
-                    if (item != null && !item.IsEmpty)
+                    _dummySlotNumber = waferInfos.Length;
+                    foreach (var item in waferInfos)
                     {
                     {
-                        Stop($"There are wafers inside the {_targetDummy},cannot do the RobotCycle action");
-                        return false;
+                        if (item != null && !item.IsEmpty)
+                        {
+                            Stop($"There are wafers inside the {_targetDummy},cannot do the RobotCycle action");
+                            return false;
+                        }
                     }
                     }
                 }
                 }
+                
             }
             }
             return true;
             return true;
         }
         }
@@ -348,8 +327,36 @@ namespace CyberX8_RT.Modules.EFEM
             }
             }
             return result;
             return result;
         }
         }
+        //更新取放dummy的位置
+        private bool UpdateMoveItem()
+        {
+            if (_lpWaferIndex.Count > 0)
+            {
+                _lpToAlignerMoveItem.Peek().SourceSlot = _lpWaferIndex.Dequeue(); //更新从LP取片的位置
+                if (_targetDummy != ModuleName.Unknown)
+                {
+                    _alignerToDummyMoveItem.Peek().DestinationSlot = (_alignerToDummyMoveItem.Peek().DestinationSlot + 1) % _dummySlotNumber; //更新放到Dummy的位置
+                    _dummyToLpMoveItem.Peek().SourceSlot = (_dummyToLpMoveItem.Peek().SourceSlot + 1) % _dummySlotNumber; //更新从dummy取片的位置,送回LP
+                    _dummyToSrdMoveItem.Peek().SourceSlot = (_dummyToSrdMoveItem.Peek().SourceSlot + 1) % _dummySlotNumber;//更新从dummy取片的位置,送到Srd
+                }
+                _dummyToLpMoveItem.Peek().DestinationSlot = _lpToAlignerMoveItem.Peek().SourceSlot;//更新从dummy放回LP的位置。 
+                _srdToLpMoveItem.Peek().DestinationSlot = _lpToAlignerMoveItem.Peek().SourceSlot;//更新从srd放回LP的位置。 
+            }
+            return true;
+        }
+        //清除MoveItem
+        private bool ClearMoveItem()
+        {
+            _lpToAlignerMoveItem.Clear();
+            _alignerToDummyMoveItem.Clear();
+            _alignerToSrdMoveItem.Clear();
+            _dummyToLpMoveItem.Clear();
+            _dummyToSrdMoveItem.Clear();
+            _srdToLpMoveItem.Clear();
+            return true;
+        }
+
 
 
-       
         #endregion
         #endregion
     }
     }
 }
 }

+ 26 - 8
CyberX8_Simulator/Devices/SunWayEfemSimulator.cs

@@ -7,6 +7,7 @@ using MECF.Framework.Simulator.Core.Driver;
 using Aitex.Core.Util;
 using Aitex.Core.Util;
 using CyberX8_Core;
 using CyberX8_Core;
 using Aitex.Core.RT.DataCenter;
 using Aitex.Core.RT.DataCenter;
+using System.Linq;
 
 
 namespace CyberX8_Simulator.Devices
 namespace CyberX8_Simulator.Devices
 {
 {
@@ -17,7 +18,7 @@ namespace CyberX8_Simulator.Devices
         private const string ACK         = "ACK";
         private const string ACK         = "ACK";
         private readonly char[] delimiters = { ':', '/', '>', '|', ';' };
         private readonly char[] delimiters = { ':', '/', '>', '|', ';' };
         private string[] _slotMap = new string[25];
         private string[] _slotMap = new string[25];
-        private string[] _slotDummy = new string[16];
+        private string[] _slotDummy = new string[25];
         private PeriodicJob _HwThread;
         private PeriodicJob _HwThread;
         private bool _bCommReady;
         private bool _bCommReady;
 
 
@@ -92,20 +93,37 @@ namespace CyberX8_Simulator.Devices
         {
         {
 
 
             string ack = ""; 
             string ack = ""; 
-            if (str.StartsWith("RQ LOAD"))
+            if (str.StartsWith("RQ LOAD")) //查询手指是否带片
             {
             {
-                ack = "LOAD A OFF\n_RDY";
+                ack = "LOAD A OFF\n_RDY"; 
             }
             }
-            else if(str.StartsWith("RSR"))
+            else if(str.StartsWith("RSR"))  //返回扫片结果
             {
             {
-                ack = "MAP 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0";
+                string[] strings = str.Split(' ').ToArray();
+                int stationNumber = int.Parse(strings[1]);
+                if (stationNumber >= 50 && stationNumber <= 58) //LP
+                {
+                    string lpwafer = "";
+                    foreach(var item in _slotMap)
+                    {
+                        lpwafer += $" {item}";
+                    }
+                    ack = "MAP" + lpwafer;
+                }
+                else if (stationNumber >= 59 && stationNumber <= 64) //dummy
+                {
+                    string dummywafer = "";
+                    foreach (var item in _slotDummy)
+                    {
+                        dummywafer += $" {item}";
+                    }
+                    ack = "MAP" + dummywafer;
+                }
             }
             }
-            else
+            else //默认回复
             {
             {
                 ack = str + "\n_RDY"; ;
                 ack = str + "\n_RDY"; ;
             }
             }
-            // 发送ACK 表示收到
-            
             OnWriteMessage(ack);
             OnWriteMessage(ack);
             // 处理INF
             // 处理INF
             //OnWork(str);
             //OnWork(str);