Browse Source

Add the configuration item QueryAWCOption to determine whether TMRobot AWC collects data && Add TMRobot Pick query AWC

zhouhr 1 year ago
parent
commit
37bbeb95df

+ 1 - 0
Venus/Venus_RT/Config/System.sccfg

@@ -148,6 +148,7 @@
 		<config default="50"  name="WithLLPressureDifference"   nameView="TM LL Pressure Difference"   description="TM和LL压差" max="100" min="0" paramter="" tag="" unit="mTorr" type="Integer" />
 		<config default="50"  name="WithPMPressureDifference"   nameView="TM PM Pressure Difference"   description="TM和PM压差" max="100" min="0" paramter="" tag="" unit="mTorr" type="Integer" />
 		<config default="0" name="SingleArmOption"   nameView="Single Arm Option"   description="0, both; 1, Blade1; 2, Blade2" max="2" min="0" paramter="" tag="" unit="" type="Integer" />
+		<config default="0" name="QueryAWCOption"   nameView="Query AWC Option"   description="0, None; 1, Only TMPick Open; 2, Only TMPlace Open; 3, Both Open" max="3" min="0" paramter="" tag="" unit="" type="Integer" />
 
 		<configs name="TM_MFC1" nameView="MFC1" >
 			<config default="true" name="Enable" nameView="Enable" description="Enable gas 1 or not" tag="" unit="" type="Bool" />

+ 63 - 0
Venus/Venus_RT/Modules/TM/MFPMPickRoutine.cs

@@ -11,6 +11,8 @@ using Aitex.Core.Util;
 using Venus_RT.Modules.PMs;
 using MECF.Framework.Common.Schedulers;
 using System.Collections.Generic;
+using System;
+using MECF.Framework.Common.DBCore;
 
 namespace Venus_RT.Modules.TM
 {
@@ -21,9 +23,11 @@ namespace Venus_RT.Modules.TM
             WaitPMReady,
             PMPrepare,
             ArmExtend,
+            QueryAWC,
             DropDownWafer,
             PickDelay,
             ArmRetract,
+            SavePickeData,
             NotifyDone,
         }
 
@@ -37,14 +41,23 @@ namespace Venus_RT.Modules.TM
         private int _targetSlot;
         private Hand _hand;
 
+        private DateTime _starttime;
+        private bool _queryAwc;
+
         public MFPMPickRoutine(JetTM tm, ITransferRobot robot) : base(ModuleName.TMRobot)
         {
             _JetTM = tm;
             _robot = robot;
             Name = "Pick from PM";
+
+            if (SC.GetValue<int>($"TM.QueryAWCOption") == 1 || SC.GetValue<int>($"TM.QueryAWCOption") == 3)
+                _queryAwc = true;
+            else
+                _queryAwc = false;
         }
         public RState Start(params object[] objs)
         {
+            _starttime = DateTime.Now;
             if (!_robot.IsHomed)
             {
                 LOG.Write(eEvent.ERR_TM, Module, $"TM Robot is not homed, please home it first");
@@ -93,9 +106,11 @@ namespace Venus_RT.Modules.TM
             Runner.Wait((int)PickStep.WaitPMReady,  () => _pmModule.IsIdle,     _delay_60s)
                 .Run((int)PickStep.PMPrepare,       ModulePrepare,              IsModulePrepareReady)
                 .Run((int)PickStep.ArmExtend,       ArmExtend,                  WaitRobotExtendDone)
+                .Run((int)PickStep.QueryAWC,        QueryAWC,                   WaitRobotQueryDone,     _delay_1s)
                 .Run((int)PickStep.DropDownWafer,   NotifyPMPickWafer,          WaitPMWaferDropDown)
                 .Delay((int)PickStep.PickDelay,     _pickDelayTime)
                 .Run((int)PickStep.ArmRetract,      ArmRetract,                 WaitRobotRetractDone)
+                .Run((int)PickStep.SavePickeData,   RecordAWCData,              NullFun)
                 .End((int)PickStep.NotifyDone,      NotifyPMDone,               _delay_50ms);
 
             return Runner.Status;
@@ -139,6 +154,54 @@ namespace Venus_RT.Modules.TM
             }
         }
 
+        private bool QueryAWC()
+        {
+            if (!_queryAwc)
+                return true;
+            else
+                return _robot.QueryAwc(); ;
+        }
+
+        private bool WaitRobotQueryDone()
+        {
+            if (!_queryAwc)
+                return true;
+
+            if (_robot.Status == RState.Running)
+            {
+                return false;
+            }
+            else if (_robot.Status == RState.End)
+            {
+                return true;
+            }
+            else
+            {
+                Runner.Stop($"TM Robot Query Awc failed, {_robot.Status}");
+                return true;
+            }
+        }
+
+        private bool RecordAWCData()
+        {
+            if (!_queryAwc)
+                return true;
+
+            //已经move后的数据
+            string _origin_module = $"LP{WaferManager.Instance.GetWafer(_targetModule, _targetSlot).OriginStation}";
+            int _origin_slot = WaferManager.Instance.GetWafer(_targetModule, _targetSlot).OriginSlot;
+            //查询完毕 插入数据
+            OffsetDataRecorder.RecordOffsetData(
+                Guid.NewGuid().ToString(),
+                _targetModule, _targetSlot,
+                ModuleName.TMRobot, 0,
+                _origin_module, _origin_slot,
+                _hand, RobotArmPan.None,
+                _robot.Offset_X, _robot.Offset_Y, _robot.Offset_D,
+                _starttime, DateTime.Now);
+            return true;
+        }
+
         private bool NotifyPMPickWafer()
         {
             _pmModule.PostMsg(PMEntity.MSG.DropDownWafer);

+ 16 - 2
Venus/Venus_RT/Modules/TM/MFPMPlaceRoutine.cs

@@ -42,12 +42,17 @@ namespace Venus_RT.Modules.TM
         private Hand _hand;
 
         private DateTime _starttime;
-
+        private bool _queryAwc;
         public MFPMPlaceRoutine(JetTM tm, ITransferRobot robot) : base(ModuleName.TMRobot)
         {
             _JetTM = tm;
             _robot = robot;
             Name = "Place to PM";
+
+            if (SC.GetValue<int>($"TM.QueryAWCOption") == 2 || SC.GetValue<int>($"TM.QueryAWCOption") == 3)
+                _queryAwc = true;
+            else
+                _queryAwc = false;
         }
         public RState Start(params object[] objs)
         {
@@ -130,7 +135,10 @@ namespace Venus_RT.Modules.TM
         }
         private bool QueryAWC()
         {
-            return _robot.QueryAwc(); ;
+            if (!_queryAwc)
+                return true;
+            else
+                return _robot.QueryAwc(); ;
         }
         private bool WaitRobotExtendDone()
         {
@@ -152,6 +160,9 @@ namespace Venus_RT.Modules.TM
 
         private bool RecordAWCData()
         {
+            if(!_queryAwc)
+                return true;
+
             //已经move后的数据
             string _origin_module = $"LP{WaferManager.Instance.GetWafer(_targetModule, _targetSlot).OriginStation}";
             int _origin_slot = WaferManager.Instance.GetWafer(_targetModule, _targetSlot).OriginSlot;
@@ -169,6 +180,9 @@ namespace Venus_RT.Modules.TM
 
         private bool WaitRobotQueryDone()
         {
+            if (!_queryAwc)
+                return true;
+
             if (_robot.Status == RState.Running)
             {
                 return false;

+ 58 - 2
Venus/Venus_RT/Modules/TM/MFPickRoutine.cs

@@ -10,6 +10,8 @@ using Aitex.Core.RT.Log;
 using Aitex.Core.Util;
 using MECF.Framework.Common.Schedulers;
 using System.Collections.Generic;
+using System;
+using MECF.Framework.Common.DBCore;
 
 namespace Venus_RT.Modules.TM
 {
@@ -21,6 +23,7 @@ namespace Venus_RT.Modules.TM
             ModulePrepare,
             OpenSlitDoor,
             Picking,
+            QueryAwc,
             CloseSlitDoor,
             NotifyDone,
         }
@@ -33,16 +36,25 @@ namespace Venus_RT.Modules.TM
         private LLEntity _llModule;
         int _targetSlot;
         Hand _hand;
-        
+
+        private DateTime _starttime;
+        private bool _queryAwc;
+
         public MFPickRoutine(JetTM tm, ITransferRobot robot) :base(ModuleName.TMRobot)
         {
             _JetTM = tm;
             _robot = robot;
             Name = "Pick";
+            if (SC.GetValue<int>($"TM.QueryAWCOption") == 1 || SC.GetValue<int>($"TM.QueryAWCOption") == 3)
+                _queryAwc = true;
+            else
+                _queryAwc = false;
         }
         public RState Start(params object[] objs)
         {
-            if(!_robot.IsHomed)
+            _starttime = DateTime.Now;
+
+            if (!_robot.IsHomed)
             {
                 LOG.Write(eEvent.ERR_TM, Module, $"TM Robot is not homed, please home it first");
                 return RState.Failed;
@@ -88,6 +100,7 @@ namespace Venus_RT.Modules.TM
                 .Run((int)PickStep.ModulePrepare,       ModulePrepare,              IsModulePrepareReady)
                 .Run((int)PickStep.OpenSlitDoor,        OpenSlitDoor,               IsSlitDoorOpen)
                 .Run((int)PickStep.Picking,             Picking,                    WaitPickDone)
+                .Run((int)PickStep.QueryAwc,            QueryAwc,                   WaitQueryDoneAndRecord)
                 .Run((int)PickStep.CloseSlitDoor,       CloseSlitDoor,              IsSlitDoorClosed)
                 .End((int)PickStep.NotifyDone,          NotifyLLDone,               _delay_50ms);         
 
@@ -156,6 +169,49 @@ namespace Venus_RT.Modules.TM
             }
         }
 
+        private bool QueryAwc()
+        {
+            if (!_queryAwc)
+                return true;
+
+            if (_robot.QueryAwc())
+                return true;
+            else
+                return false;
+        }
+
+        private bool WaitQueryDoneAndRecord()
+        {
+            if (!_queryAwc)
+                return true;
+
+            if (_robot.Status == RState.Running)
+            {
+                return false;
+            }
+            else if (_robot.Status == RState.End)
+            {
+                //已经move后的数据
+                string _origin_module = $"LP{WaferManager.Instance.GetWafer(_targetModule, _targetSlot).OriginStation}";
+                int _origin_slot = WaferManager.Instance.GetWafer(_targetModule, _targetSlot).OriginSlot;
+                //查询完毕 插入数据
+                OffsetDataRecorder.RecordOffsetData(
+                    Guid.NewGuid().ToString(),
+                    _targetModule, _targetSlot,
+                    ModuleName.TMRobot, 0,
+                    _origin_module, _origin_slot,
+                    _hand, RobotArmPan.None,
+                    _robot.Offset_X, _robot.Offset_Y, _robot.Offset_D,
+                    _starttime, DateTime.Now);
+                return true;
+            }
+            else
+            {
+                Runner.Stop($"TM Robot Query Awc failed, {_robot.Status}");
+                return true;
+            }
+        }
+
         private bool NotifyLLDone()
         {
             _llModule.PostMsg(LLEntity.MSG.TM_Exchange_Ready);

+ 12 - 2
Venus/Venus_RT/Modules/TM/MFPlaceRoutine.cs

@@ -38,6 +38,7 @@ namespace Venus_RT.Modules.TM
         Hand _hand;
 
         private DateTime _starttime;
+        private bool _queryAwc;
 
         public MFPlaceRoutine(JetTM tm, ITransferRobot robot) : base(ModuleName.TMRobot)
         {
@@ -45,11 +46,14 @@ namespace Venus_RT.Modules.TM
             _robot = robot;
 
             Name = "Place";
+            if (SC.GetValue<int>($"TM.QueryAWCOption") == 2 || SC.GetValue<int>($"TM.QueryAWCOption") == 3)
+                _queryAwc = true;
+            else
+                _queryAwc = false;
         }
         public RState Start(params object[] objs)
         {
             _starttime = DateTime.Now;
-
             if (!_robot.IsHomed)
             {
                 LOG.Write(eEvent.ERR_TM, Module, $"TM Robot is not homed, please home it first");
@@ -85,7 +89,7 @@ namespace Venus_RT.Modules.TM
 
             Reset();
             _placingTimeout = SC.GetValue<int>($"TM.PlaceTimeout") * 1000;
-
+            
             return Runner.Start(Module, $"Place to {_targetModule}");
         }
 
@@ -164,6 +168,9 @@ namespace Venus_RT.Modules.TM
 
         private bool QueryAwc()
         {
+            if (!_queryAwc)
+                return true;
+
             if (_robot.QueryAwc())
                 return true;
             else
@@ -172,6 +179,9 @@ namespace Venus_RT.Modules.TM
 
         private bool WaitQueryDoneAndRecord()
         {
+            if (!_queryAwc)
+                return true;
+
             if (_robot.Status == RState.Running)
             {
                 return false;

+ 1 - 1
Venus/Venus_Simulator/Devices/TMSimulatorServer.cs

@@ -34,7 +34,7 @@ namespace Venus_Simulator.Devices
 
             if (str.Contains("RQ WAF_CEN DATA"))
             {
-                string t = new Random().Next(0,359).ToString().PadLeft(6, '0');
+                string t = new Random().Next(0, 359).ToString().PadLeft(6, '0');
                 string r = new Random().Next(0, 50000).ToString().PadLeft(6, '0');
                 OnWriteMessage($"WAF_CEN RT 000000 000000 000000 000000 LFT 000000 000000 000000 000000 OFFSET {r} {t}");
                 OnWriteMessage("_RDY");