Bläddra i källkod

EFEM Align UI RT 更新

Intern01 1 år sedan
förälder
incheckning
aaff066e93

+ 1 - 1
Venus/Venus_MainPages/Views/EfemView.xaml

@@ -180,7 +180,7 @@
                     <customControls:PathButton Content="Up"  Width="80"   Height="33" Command="{Binding Align1UpCommand}"/>
                     <customControls:PathButton Content="Down" Width="80"  Height="33" Command="{Binding Align1DownCommand}"/>
                     <customControls:PathButton Content="Align" Width="80" Height="33" Command="{Binding Align1AlignCommand}"/>
-                    <TextBox Text="{Binding AlignValue}" Width="60" Height="33" VerticalContentAlignment="Center" HorizontalContentAlignment="Center" Margin="1,0,1,0" FontSize="20"/>
+                    <TextBox Text="{Binding AlignValue,UpdateSourceTrigger=PropertyChanged}" Width="60" Height="33" VerticalContentAlignment="Center" HorizontalContentAlignment="Center" Margin="1,0,1,0" FontSize="20"/>
                 </StackPanel>
             </Border>
 

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

@@ -106,7 +106,7 @@ namespace Venus_RT.Devices.EFEM
         public abstract bool Map(ModuleName mod);
         public abstract bool SetPinUp(ModuleName mod);
         public abstract bool SetPinDown(ModuleName mod);
-        public abstract bool Align(ModuleName mod, float delayTime, WaferSize size);
+        public abstract bool Align(ModuleName mod, double angle,float delayTime, WaferSize size);
         public abstract bool SetLamp(LightType light, LightStatus status);
         public abstract bool Load(ModuleName mod);
         public abstract bool Unload(ModuleName mod);

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

@@ -92,7 +92,6 @@ namespace Venus_RT.Devices.EFEM
             _subscribeLoc(ModuleName.LP2, SC.GetValue<int>("EFEM.LoadPort.SlotNumber"));
             _subscribeLoc(ModuleName.LP3, SC.GetValue<int>("EFEM.LoadPort.SlotNumber"));
 
-
         }
 
         public override void Monitor()
@@ -436,7 +435,7 @@ namespace Venus_RT.Devices.EFEM
             _status = RState.Running;
             return _socket.Write(_currentMsg.ToString());
         }
-        public override bool Align(ModuleName mod, float delayTime, WaferSize size)
+        public override bool Align(ModuleName mod, double angle, float delayTime, WaferSize size)
         {
             if (!CheckEfemStatus())
                 return false;
@@ -445,7 +444,7 @@ namespace Venus_RT.Devices.EFEM
             {
                 Operation =  EfemOperation.Align,
                 Head = EfemMessage.MsgHead.MOV,
-                Parameters = new List<string> { mod.ToHWString(), size.ToString() }
+                Parameters = new List<string> { $"A{angle.ToString("000.00")}" }
             };
 
             _status = RState.Running;

+ 117 - 0
Venus/Venus_RT/Modules/EFEM/EFEMAlignRoutine.cs

@@ -0,0 +1,117 @@
+using Aitex.Core.Common;
+using Aitex.Core.RT.Log;
+using Aitex.Core.RT.Routine;
+using Aitex.Sorter.Common;
+using MECF.Framework.Common.Equipment;
+using MECF.Framework.Common.Schedulers;
+using MECF.Framework.Common.SubstrateTrackings;
+using System;
+using System.Collections.Generic;
+using System.Diagnostics;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Venus_Core;
+using Venus_RT.Devices.EFEM;
+
+namespace Venus_RT.Modules.EFEM
+{
+    public class EFEMAlignRoutine : ModuleRoutineBase, IRoutine
+    {
+        private enum AlignStep
+        {
+            WaitIdle,
+            Rotate,
+            End
+        }
+
+        private int _moveTimeout = 20 * 1000;
+        EfemBase _efem;
+        private double angle = 25;
+        private WaferSize ws = WaferSize.WS12;
+
+        public EFEMAlignRoutine(EfemBase efem) : base(ModuleName.Aligner1)
+        {
+            _efem = efem;
+        }
+
+        public RState Start(params object[] objs)
+        {
+            if (!_efem.IsHomed)
+            {
+                LOG.Write(eEvent.ERR_EFEM_COMMON_FAILED, Module, $"EFEM is not homed, please home it first");
+                return RState.Failed;
+            }
+
+            if (objs.Length >= 3)
+            {
+                try
+                {
+                    angle = Convert.ToDouble(objs[2]);
+                }
+                catch (Exception ex)
+                {
+                    LOG.Write(eEvent.ERR_EFEM_COMMON_FAILED, Module, $"ALIAN PARAMETER IS ILLEGAL ");
+                }
+               
+            }
+
+            if (!WaferManager.Instance.CheckHasWafer(ModuleName.Aligner1, 0))
+            {
+                LOG.Write(eEvent.ERR_EFEM_ROBOT, Module, $"Efem PreAligner not have wafer, cannot do the align action");
+                return RState.Failed;
+            }
+            else
+            {
+                Trace.WriteLine("开始Align");
+                return Runner.Start(Module,$"PreAligner Start align");
+            }
+        }
+
+
+        public RState Monitor()
+        {
+            Runner.Wait((int)AlignStep.WaitIdle, WaitEFEMIdle,0)
+                .Run((int)AlignStep.Rotate,fnalign,CheckAlignDone, _moveTimeout)
+                .End((int)AlignStep.End,ActionDone);
+            return Runner.Status;
+        }
+
+        private bool fnalign()
+        {
+            return _efem.Align(Module,angle,0,ws);
+        }
+
+        private bool CheckAlignDone()
+        {
+            if (_efem.Status == RState.End)
+            {
+
+                return true;
+            }
+            else if (_efem.Status != RState.Running)
+            {
+                LOG.Write(eEvent.ERR_EFEM_COMMON_FAILED, Module, $"Efem PreAligner align failed: {_efem.Status}");
+                return true;
+            }
+
+            return false;
+        }
+
+        private bool ActionDone()
+        {
+            return true;
+        }
+
+        private bool WaitEFEMIdle()
+        {
+            return true;
+        }
+
+        public void Abort()
+        {
+            throw new NotImplementedException();
+        }
+
+    }
+}

+ 42 - 19
Venus/Venus_RT/Modules/EFEM/EfemEntity.cs

@@ -131,6 +131,7 @@ namespace Venus_RT.Modules
         private readonly EfemPlaceRoutine _placeRoutine;
         private readonly EfemSwapRoutine _swapRoutine;
         private readonly EfemHomeRoutine _homeRoutine;
+        private readonly EFEMAlignRoutine _alignRoutine;
         private string LiftMessage;
 
         // Constructor
@@ -147,6 +148,7 @@ namespace Venus_RT.Modules
             _pickRoutine    = new EfemPickRoutine(_efem);
             _placeRoutine   = new EfemPlaceRoutine(_efem);
             _swapRoutine    = new EfemSwapRoutine(_efem);
+            _alignRoutine = new EFEMAlignRoutine(_efem);
 
             InitFsmMap();
         }
@@ -286,6 +288,7 @@ namespace Venus_RT.Modules
             //Transition(STATE.Lifting,       MSG.LiftActionDone,     fnActionDone,       STATE.Idle);
             Transition(STATE.Lifting,       FSM_MSG.TIMER,          fnLiftTimeout,    STATE.Idle);
             Transition(STATE.Idle,          MSG.Align,              fnAlign,            STATE.Aligning);
+            Transition(STATE.Aligning,      FSM_MSG.TIMER,          fnAlignTimeout, STATE.Idle);
             Transition(STATE.Aligning,      MSG.ActionDone,         fnActionDone,       STATE.Idle);
 
 
@@ -296,6 +299,7 @@ namespace Venus_RT.Modules
             Running = true;
         }
 
+
         private bool fnCommReady(object[] param)
         {
             return true;
@@ -551,30 +555,49 @@ namespace Venus_RT.Modules
         private bool fnAlign(object[] param)
         {
             // module
-            ModuleName unit = ModuleName.EFEM;
-            if (param[0] is string s1)
-                unit = ModuleNameString.ToEnum(s1);
-            else if (param[0] is ModuleName mod)
-                unit = mod;
-            else
-                throw new ArgumentException("Argument error");
+            //ModuleName unit = ModuleName.EFEM;
 
+            //if (param.Length < 2)
+            //{
+            //    return _efem.Align(unit, 180, 1000, WaferSize.WS12);
 
-            // wafer size
-            WaferSize ws1 = WaferSize.WS0;
-            if (param[1] is string s2)
-            {
-                if (Enum.TryParse(s2, out WaferSize p5))
-                    ws1 = p5;
-            }
-            else if (param[1] is WaferSize p6)
+            //}
+
+            //if (param[0] is string s1)
+            //    unit = ModuleNameString.ToEnum(s1);
+            //else if (param[0] is ModuleName mod)
+            //    unit = mod;
+            //else
+            //    throw new ArgumentException("Argument error");
+
+            //// wafer size
+            //WaferSize ws1 = WaferSize.WS0;
+            //if (param[1] is string s2)
+            //{
+            //    if (Enum.TryParse(s2, out WaferSize p5))
+            //        ws1 = p5;
+            //}
+            //else if (param[1] is WaferSize p6)
+            //{
+            //    ws1 = p6;
+            //}
+
+            //if (!_efem.Align(unit, 180,1000, ws1))
+            //    return false;
+            return _alignRoutine.Start(param) == RState.Running;
+        }
+
+
+        private bool fnAlignTimeout(object[] param)
+        {
+            RState ret = _alignRoutine.Monitor();
+            if (ret == RState.Failed || ret == RState.Timeout)
             {
-                ws1 = p6;
+                PostMsg(MSG.Error);
+                return false;
             }
 
-            if (!_efem.Align(unit, 1000, ws1))
-                return false;
-            return true;
+            return ret == RState.End;
         }
 
         private bool fnMap(object[] param)

+ 1 - 1
Venus/Venus_RT/Modules/LPs/LoadPortModule.cs

@@ -318,7 +318,7 @@ namespace Venus_RT.Modules.LPs
         private bool FsmMonitorTask(object[] param)
         {
             RState ret = MonitorRoutine();
-            if (ret == RState.Failed)
+            if (ret == RState.Failed || ret == RState.Timeout)
             {
                 PostMsg(MSG.Error);
                 return false;

+ 1 - 0
Venus/Venus_RT/Venus_RT.csproj

@@ -177,6 +177,7 @@
     <Compile Include="Instances\ToolLoader.cs" />
     <Compile Include="Modules\AutoCycle.cs" />
     <Compile Include="Modules\Autotransfer_LP_FA.cs" />
+    <Compile Include="Modules\EFEM\EFEMAlignRoutine.cs" />
     <Compile Include="Modules\EFEM\EfemEntity.cs" />
     <Compile Include="Modules\EFEM\EfemHomeRoutine.cs" />
     <Compile Include="Modules\EFEM\EfemPickRoutine.cs" />