瀏覽代碼

Debug EFEM device driver.

sangwq 1 年之前
父節點
當前提交
a4dfe941cc

+ 2 - 2
Venus/Framework/Common/Fsm/StateMachine.cs

@@ -162,7 +162,7 @@ namespace Aitex.Core.RT.Fsm
                                     ///add log
                                     if (Name == "EFEM FSM")
                                     {
-                                        LOG.Write(eEvent.EV_FSM_NOTIFY, MECF.Framework.Common.Equipment.ModuleName.System, $"状态机 {Name}收到消息 {GetStringMessage(_msgInProcess.Key)}, 状态 {GetStringState(PrevState)}==>{GetStringState(State)}");
+                                        LOG.Write(eEvent.EV_FSM_NOTIFY, MECF.Framework.Common.Equipment.ModuleName.System, $"状态机 {Name}收到消息 {GetStringMessage(_msgInProcess.Key)}, 状态 {GetStringState(PrevState)}==>{GetStringState(State)}");
                                     }
 
 
@@ -229,7 +229,7 @@ namespace Aitex.Core.RT.Fsm
                             ///add log
                             if (Name == "EFEM FSM")
                             {
-                                LOG.Write(eEvent.EV_FSM_NOTIFY, MECF.Framework.Common.Equipment.ModuleName.System, $"状态机 {Name}收到消息 {GetStringMessage(_msgInProcess.Key)}, 状态 {GetStringState(PrevState)}==>{GetStringState(State)}");
+                                LOG.Write(eEvent.EV_FSM_NOTIFY, MECF.Framework.Common.Equipment.ModuleName.System, $"状态机 {Name}收到消息 {GetStringMessage(_msgInProcess.Key)}, 状态 {GetStringState(PrevState)}==>{GetStringState(State)}");
                             }
 
                             OnEnterState((int)FSM_STATE.ANY);

+ 1 - 1
Venus/Venus_RT/Devices/EFEM/EfemBase.cs

@@ -86,7 +86,7 @@ namespace Venus_RT.Devices.EFEM
         public virtual bool IsHomed { get; }
         public abstract bool HomeAll();
         public abstract bool Home(ModuleName mod);
-        public abstract bool OriginalSearch();
+        public abstract bool OriginalSearch(ModuleName mod);
         public abstract bool CheckWaferPresence();
         public abstract string GetWaferPresence();
         public abstract bool Halt();

+ 4 - 0
Venus/Venus_RT/Devices/EFEM/EfemMessage.cs

@@ -322,6 +322,8 @@ namespace Venus_RT.Devices.YASKAWA
         {
             [ModuleName.EFEM]     = "ALL",
             [ModuleName.EfemRobot]= "ROB",
+            [ModuleName.LLA]      = "LLLA",
+            [ModuleName.LLB]      = "LLLB",
             [ModuleName.LP1]      = "P1",
             [ModuleName.LP2]      = "P2",
             [ModuleName.PMA]      = "LLA",
@@ -346,6 +348,8 @@ namespace Venus_RT.Devices.YASKAWA
             ["ALIGN3"] = ModuleName.Aligner1,
             ["ALIGN4"] = ModuleName.Aligner2,
             ["BUFFER"] = ModuleName.Buffer,
+            ["LLLA"]   = ModuleName.LLA,
+            ["LLLB"]   = ModuleName.LLB,
         };
 
         public static readonly Dictionary<Hand, string> ArmString = new Dictionary<Hand, string>

+ 3 - 2
Venus/Venus_RT/Devices/EFEM/JetEfem.cs

@@ -146,7 +146,7 @@ namespace Venus_RT.Devices.EFEM
             
         }
 
-        public override bool OriginalSearch()
+        public override bool OriginalSearch(ModuleName mod)
         {
             if (!CheckEfemStatus())
                 return false;
@@ -157,7 +157,7 @@ namespace Venus_RT.Devices.EFEM
                 Head = EfemMessage.MsgHead.MOV,
                 Parameters = new List<string>
                 {
-                    Constant.ModuleString[ModuleName.EFEM] 
+                    Constant.ModuleString[mod] 
                 }
             };
 
@@ -766,6 +766,7 @@ namespace Venus_RT.Devices.EFEM
                 case EfemOperation.StateTrack:
                     {
                         _waferPresence = message.Data.Count >= 1 ? message.Data.First() : string.Empty;
+                        _IsHomed = true;
                         _status = RState.End;
                     }
                     break;

+ 61 - 58
Venus/Venus_RT/Modules/EFEM/EfemEntity.cs

@@ -1,4 +1,5 @@
 using System;
+using System.Collections.Generic;
 using Aitex.Core.Common;
 using Aitex.Core.RT.DataCenter;
 using Aitex.Core.RT.Event;
@@ -58,9 +59,7 @@ namespace Venus_RT.Modules
             Place,              // 2
             Align,              // 3
             ActionDone,         // 4
-            RecHwMsg,           // 5
             MoveCmd,            // 6
-            //LED,                // 7
             Recover,            // 8
             Goto,               // 9
             Error,              // 10
@@ -74,7 +73,6 @@ namespace Venus_RT.Modules
             PMLiftPinUp,        // 18
             PMLiftPinDown,      // 19
             TurnOffBuzzer, 
-            //SwitchOnBuzzerAndRed,
             Abort,
             Map,
 			ToInit,
@@ -92,6 +90,27 @@ namespace Venus_RT.Modules
             JetEfem = 2,
             BrooksEFEM = 3,
         }
+        public bool IsIdle
+        {
+            get { return fsm.State == (int)STATE.Idle; }
+        }
+
+        public bool IsError
+        {
+            get { return fsm.State == (int)STATE.Error; }
+        }
+
+        public bool IsInit
+        {
+            get { return fsm.State == (int)STATE.Unknown || fsm.State == (int)STATE.Init; }
+        }
+
+        public bool IsBusy
+        {
+            get { return !IsInit && !IsError && !IsIdle; }
+        }
+
+        public bool IsOnline { get; internal set; }
 
         public bool Check(int msg, out string reason, params object[] args)
         {
@@ -117,9 +136,6 @@ namespace Venus_RT.Modules
         //
         public EfemEntity()
         {
-            //_smallWafer = SC.GetValue<int>($"System.SmallWafer");
-            //_midWafer = SC.GetValue<int>($"System.MidWafer");
-            //_bigWafer = SC.GetValue<int>($"System.BigWafer");
             _efemType = (EfemType)SC.GetValue<int>($"EFEM.EfemType");
 
             _efem = new JetEfem();
@@ -159,8 +175,6 @@ namespace Venus_RT.Modules
             OP.Subscribe($"{ModuleName.EFEM}.Online",                           (cmd, args) => { PostMsg(MSG.Online); return true; });
             OP.Subscribe($"{ModuleName.EfemRobot}.{EfemOperation.Pick}",        (cmd, args) => { PostMsg(MSG.Pick, args[0], args[1], args[3], args[2]); return true; });
             OP.Subscribe($"{ModuleName.EfemRobot}.{EfemOperation.Place}",       (cmd, args) => { PostMsg(MSG.Place, args[0], args[1], args[3], args[2]); return true; });
-            OP.Subscribe($"{ModuleName.EfemRobot}.{EfemOperation.Extend}",      (cmd, args) => { PostMsg(MSG.Extend, args[0], args[1], args[2]); return true; });
-            OP.Subscribe($"{ModuleName.EfemRobot}.{EfemOperation.Retract}",     (cmd, args) => { PostMsg(MSG.Retract, args[0], args[1]); return true; });
             OP.Subscribe($"{ModuleName.EfemRobot}.{EfemOperation.Abort}",       (cmd, args) => { PostMsg(MSG.Abort); return true; });
             OP.Subscribe($"{ModuleName.EfemRobot}.{EfemOperation.Home}",        (cmd, args) => { PostMsg(MSG.HomeRB); return true; });
             OP.Subscribe($"{ModuleName.EfemRobot}.{EfemOperation.Grip}",        (cmd, args) =>
@@ -190,9 +204,6 @@ namespace Venus_RT.Modules
             DATA.Subscribe($"{Name}.FsmState",          () => ((STATE)fsm.State).ToString());
             DATA.Subscribe($"{Name}.FsmPrevState",      () => ((STATE)fsm.PrevState).ToString());
             DATA.Subscribe($"{Name}.FsmLastMessage",    GetFsmLastMessage);
-            DATA.Subscribe($"{Name}.SmallWafer",        () => _smallWafer);
-            DATA.Subscribe($"{Name}.BigWafer",          () => _bigWafer);
-            DATA.Subscribe($"{Name}.MidWafer",          () => _midWafer);
 
             return true;
         }
@@ -219,13 +230,17 @@ namespace Venus_RT.Modules
 
             // Home
             Transition(STATE.Init,          MSG.HomeAll,            fnHomeAll,          STATE.Initializing);
-            Transition(STATE.Idle,          MSG.HomeAll,            fnHomeAll,          STATE.Initializing);    // 暂时加,出错的时候做 HOME
+            Transition(STATE.Idle,          MSG.HomeAll,            fnHomeAll,          STATE.Initializing);    
             Transition(STATE.Error,         MSG.HomeAll,            fnHomeAll,          STATE.Initializing);
             Transition(STATE.Initializing,  FSM_MSG.TIMER,          fnHomingTimeout,    STATE.Idle);
 
-            Transition(STATE.Orgshing,      MSG.ActionDone,         fnActionDone,       STATE.Idle);
+            // Home Robot
             Transition(STATE.Idle,          MSG.HomeRB,             fnHomeRobot,        STATE.InitingRB);
-            Transition(STATE.InitingRB,     MSG.ActionDone,         null,               STATE.Idle);
+            Transition(STATE.InitingRB,     FSM_MSG.TIMER,          fnHomingTimeout,    STATE.Idle);
+
+            // Home Aligner
+            Transition(STATE.Idle,          MSG.HomeAL,             fnHomeAligner,      STATE.InitingAL);
+            Transition(STATE.InitingAL,     FSM_MSG.TIMER,          fnHomingTimeout,    STATE.Idle);
 
             // Pick wafer
             Transition(STATE.Idle,          MSG.Pick,               FnStartPick,        STATE.Picking);
@@ -260,8 +275,6 @@ namespace Venus_RT.Modules
             Transition(STATE.Ungripping,    MSG.ActionDone,         fnActionDone,       STATE.Idle);
 
             // Aligner
-            Transition(STATE.Idle,          MSG.HomeAL,             fnHomeAligner,      STATE.InitingAL);
-            Transition(STATE.InitingAL,     MSG.ActionDone,         fnActionDone,       STATE.Idle);
             Transition(STATE.Idle,          MSG.Lift,               fnLift,             STATE.Lifting);
             Transition(STATE.Lifting,       MSG.LiftActionDone,     fnActionDone,       STATE.Idle);
             Transition(STATE.Idle,          MSG.Align,              fnAlign,            STATE.Aligning);
@@ -298,8 +311,7 @@ namespace Venus_RT.Modules
 
         private bool fnHomeRobot(object[] param)
         {
-            _efem.Home(ModuleName.EfemRobot);
-            return true;
+            return _homeRoutine.Start(ModuleName.EfemRobot) == RState.Running;
         }
 
         private bool fnHomeAligner(object[] param)
@@ -313,8 +325,7 @@ namespace Venus_RT.Modules
             else
                 throw new ArgumentException("Argument error");
 
-            _efem.Home(unit);
-            return true;
+            return _homeRoutine.Start(unit) == RState.Running;
         }
 
         private bool fnActionDone(object[] param)
@@ -403,20 +414,6 @@ namespace Venus_RT.Modules
             return false;
         }
 
-        //private bool fnSwitchOnBuzzerAndRed(object[] param)
-        //{
-        //    _efem.SwitchOnBuzzerAndRed();
-        //    return false;
-        //}
-        //
-
-        private bool fnSetLampDone(object[] param)
-        {
-            {
-                return true;
-            }
-        }
-
         private bool FnStartPick(object[] param)
         {
             return _pickRoutine.Start(param) == RState.Running;
@@ -597,28 +594,6 @@ namespace Venus_RT.Modules
             return true;
         }
 
-        public bool IsIdle
-        {
-            get { return fsm.State == (int)STATE.Idle; }
-        }
-
-        public bool IsError
-        {
-            get { return fsm.State == (int)STATE.Error; }
-        }
-
-        public bool IsInit
-        {
-            get { return fsm.State == (int)STATE.Unknown || fsm.State==(int)STATE.Init; }
-        }
-
-        public bool IsBusy
-        {
-            get { return !IsInit && !IsError && !IsIdle; }
-        }
-
-        public bool IsOnline { get; internal set; }
-
         public int Invoke(string function, params object[] args)
         {
             switch (function)
@@ -759,23 +734,51 @@ namespace Venus_RT.Modules
             // Test Home routine
             if (flag == 1)
             {
-
                 PostMsg(MSG.HomeAll);
             }
             else if (flag == 2)
             {
+                WaferManager.Instance.CreateWafer(ModuleName.Aligner1, 0, WaferStatus.Normal);
+                WaferManager.Instance.DeleteWafer(ModuleName.EfemRobot, 0);
+                var item = new MoveItem(ModuleName.Aligner1, 0, ModuleName.EfemRobot, 0, Hand.Blade1);
+                var items = new Queue<MoveItem>();
+                items.Enqueue(item);
+                PostMsg(MSG.Pick, items);
             }
             else if (flag == 3)
             {
+                var item = new MoveItem( ModuleName.EfemRobot, 0, ModuleName.Aligner1, 0, Hand.Blade1);
+                var items = new Queue<MoveItem>();
+                items.Enqueue(item);
+                PostMsg(MSG.Place, items);
             }
             else if (flag == 4)
             {
+                WaferManager.Instance.CreateWafer(ModuleName.LLA, 0, WaferStatus.Normal);
+                WaferManager.Instance.CreateWafer(ModuleName.LLA, 1, WaferStatus.Normal);
+                WaferManager.Instance.DeleteWafer(ModuleName.LLA, 2);
+                WaferManager.Instance.DeleteWafer(ModuleName.LLA, 3);
+                WaferManager.Instance.CreateWafer(ModuleName.EfemRobot, 0, WaferStatus.Normal);
+                WaferManager.Instance.CreateWafer(ModuleName.EfemRobot, 1, WaferStatus.Normal);
+                var item = new MoveItem(ModuleName.EfemRobot, 0, ModuleName.LLA, 2, Hand.Blade1);
+                var items = new Queue<MoveItem>();
+                items.Enqueue(item);
+                item = new MoveItem(ModuleName.EfemRobot, 1, ModuleName.LLA, 3, Hand.Blade2);
+                items.Enqueue(item);
+                item = new MoveItem(ModuleName.LLA, 0, ModuleName.EfemRobot, 0, Hand.Blade1);
+                items.Enqueue(item);
+                item = new MoveItem(ModuleName.LLA, 1, ModuleName.EfemRobot, 1, Hand.Blade2);
+                items.Enqueue(item);
+                PostMsg(MSG.Swap, items);
             }
             else if (flag == 5)
             {
+                PostMsg(MSG.HomeRB);
             }
             else if (flag == 6)
-            { }
+            {
+                PostMsg(MSG.HomeAL, ModuleName.Aligner1);
+            }
         }
     }
 

+ 10 - 3
Venus/Venus_RT/Modules/EFEM/EfemHomeRoutine.cs

@@ -29,6 +29,7 @@ namespace Venus_RT.Modules.EFEM
         private enum HomeModuleStep
         {
             Home,
+            HomeAxes,
             End,
         }
 
@@ -63,8 +64,9 @@ namespace Venus_RT.Modules.EFEM
             }
             else
             {
-                Runner.Run((int)HomeModuleStep.Home,    HomeModule,     IsStepComplete,     _homeTimeout)
-                    .End((int)HomeModuleStep.End,       NullFun,        _delay_50ms);
+                Runner.Run((int)HomeModuleStep.Home,        HomeModule,         IsStepComplete,     _homeTimeout)
+                    .Run((int)HomeModuleStep.HomeAxes,      HomeModuleAxes,     IsStepComplete,     _homeTimeout)
+                    .End((int)HomeModuleStep.End,           NullFun,            _delay_50ms);
             }
 
 
@@ -107,7 +109,12 @@ namespace Venus_RT.Modules.EFEM
 
         private bool HomeAllAxes()
         {
-            return _efem.OriginalSearch();
+            return _efem.OriginalSearch(ModuleName.EFEM);
+        }
+
+        private bool HomeModuleAxes()
+        {
+            return _efem.OriginalSearch(_targetModule);
         }
 
         private bool CheckWaferPresence()