Browse Source

修复efem place ,tm同时有lp1与lp2 wafer时return wafer报错bug

lixiang 1 year ago
parent
commit
96661cadab

+ 4 - 4
Venus/Framework/SimulatorCore/Commons/DeviceSimulator.cs

@@ -55,10 +55,10 @@ namespace MECF.Framework.Simulator.Core.Driver
 
         protected void OnReadMessage(string message)
         {
-            //if (message.Contains("FETCH"))
-            //{ 
-            
-            //}
+            if (message.Contains("FETCH"))
+            {
+
+            }
             if (MessageIn != null)
             {
                 MessageIn(message);

+ 4 - 4
Venus/Venus_RT/Devices/JetKepler2200BPM.cs

@@ -243,10 +243,10 @@ namespace Venus_RT.Devices
         {
             return _ATM_sw.Value && ChamberPressure > 700000;
         }
-        //public override bool CheckSlitDoorOpen()
-        //{
-        //    return _slitDoor.State == CylinderState.Open;
-        //}
+        public override bool CheckSlitDoorOpen()
+        {
+            return _slitDoor.State == CylinderState.Open;
+        }
 
         public override bool CheckSlitDoorClose()
         {

+ 12 - 3
Venus/Venus_RT/Devices/PendulumValve.cs

@@ -15,6 +15,7 @@ using Aitex.Core.Common.DeviceData;
 using MECF.Framework.Common.CommonData.DeviceData;
 using Aitex.Core.RT.DataCenter;
 using Venus_RT.Modules.PMs;
+using System.Linq;
 
 namespace Venus_RT.Devices
 {
@@ -181,7 +182,14 @@ namespace Venus_RT.Devices
         private readonly AsyncSerialPort _serial;
         private Stopwatch _queryWatch = new Stopwatch();
         private string _lastAlarmString = string.Empty;
-        private Operation[] _querys = new Operation[] { Operation.GetPressure, Operation.GetPosition, Operation.GetDeviceStatus, Operation.GetP, Operation.GetI };
+        private Operation[] _querys = new Operation[]
+        {
+            Operation.GetPressure,
+            Operation.GetPosition,
+            Operation.GetDeviceStatus,
+            Operation.GetP,
+            Operation.GetI
+        };
         BlockingCollection<string> blockingCollection = new BlockingCollection<string>();
         private JetChamber   m_JetChamber;
         private PressureType m_PressureType;
@@ -256,9 +264,9 @@ namespace Venus_RT.Devices
 
         public void Monitor()
         {
-            if (_queryWatch.ElapsedMilliseconds > _readInterval)
+            if (_queryWatch.ElapsedMilliseconds > _readInterval && _querys.Length>0)
             {
-                SendCommand(_querys[_queryFlag++ % 5]);
+                SendCommand(_querys[_queryFlag++ % _querys.Length]);
                 _queryWatch.Restart();
             }
             //var isopen = _serial.IsOpen();
@@ -304,6 +312,7 @@ namespace Venus_RT.Devices
                                 if ((m_JetChamber == JetChamber.Kepler2200A || m_JetChamber == JetChamber.Kepler2200B))
                                 {
                                     Pressure =Convert.ToSingle( ConvertPressureUnit.ConvertPaTomtorr( pressure * _pressure_ful_range / 1000000));
+                                    //Pressure = pressure * _pressure_ful_range / 1000000;
                                 }
 								else if(m_JetChamber == JetChamber.VenusSE || m_JetChamber == JetChamber.VenusDE)
                                 {

+ 16 - 7
Venus/Venus_RT/Modules/EFEM/EfemPlaceRoutine.cs

@@ -26,6 +26,8 @@ namespace Venus_RT.Modules.EFEM
 
         private int _moveTimeout = 20 * 1000;
         private ModuleName _targetModule = ModuleName.System;
+        private ModuleName _targetModule2 = ModuleName.System;
+
         int _targetSlot;
         int _targetSlot2;
         Hand _hand;
@@ -66,7 +68,9 @@ namespace Venus_RT.Modules.EFEM
 
             if (placeItem.Count >= 2)
             {
-                if (!ModuleHelper.IsLoadPort(_targetModule))
+                placeItem.Dequeue();
+                _targetModule2 = placeItem.Peek().DestinationModule;
+                if (!ModuleHelper.IsLoadPort(_targetModule2))
                 {
                     LOG.Write(eEvent.ERR_EFEM_ROBOT, Module, $"Wrong double place command, target is not loadport");
                     return RState.Failed;
@@ -79,10 +83,10 @@ namespace Venus_RT.Modules.EFEM
                     return RState.Failed;
                 }
 
-                _targetSlot2 = placeItem.ToArray()[1].DestinationSlot;
-                if (WaferManager.Instance.CheckHasWafer(_targetModule, _targetSlot2))
+                _targetSlot2 = placeItem.ToArray()[0].DestinationSlot;
+                if (WaferManager.Instance.CheckHasWafer(_targetModule2, _targetSlot2))
                 {
-                    LOG.Write(eEvent.ERR_EFEM_ROBOT, Module, $"The target: {_targetModule}{_targetSlot2} has a wafer, cannot do the double place action");
+                    LOG.Write(eEvent.ERR_EFEM_ROBOT, Module, $"The target: {_targetModule2} {_targetSlot2} has a wafer, cannot do the double place action");
                     return RState.Failed;
                 }
 
@@ -90,7 +94,12 @@ namespace Venus_RT.Modules.EFEM
             }
 
             _moveTimeout = SC.GetValue<int>($"EFEM.MotionTimeout") * 1000;
-            return Runner.Start(Module, $"Place to {_targetModule}");
+            string targetModule2 = "";
+            if (_targetModule2 != ModuleName.System)
+            {
+                targetModule2 = _targetModule2.ToString();
+            }
+            return Runner.Start(Module, $"Place to {_targetModule} {targetModule2}");
         }
 
         public RState Monitor()
@@ -145,14 +154,14 @@ namespace Venus_RT.Modules.EFEM
 
         private bool Place2()
         {
-            return _efem.Place(_targetModule, _targetSlot2, _hand2);
+            return _efem.Place(_targetModule2, _targetSlot2, _hand2);
         }
 
         private bool Place2Done()
         {
             if (_efem.Status == RState.End)
             {
-                WaferManager.Instance.WaferMoved(ModuleName.EfemRobot, (int)_hand2, _targetModule, _targetSlot2);
+                WaferManager.Instance.WaferMoved(ModuleName.EfemRobot, (int)_hand2, _targetModule2, _targetSlot2);
                 return true;
             }
             else if (_efem.Status != RState.Running)

+ 32 - 30
Venus/Venus_RT/Modules/Schedulers/SchedulerEfemRobot.cs

@@ -73,9 +73,9 @@ namespace Venus_RT.Scheduler
             _increasingAngle = SC.GetValue<int>($"EFEM.Aligner.IncreasingAngle");
         }
 
-        public bool Goto(ModuleName target, int slot )
+        public bool Goto(ModuleName target, int slot)
         {
-            _entityTaskToken = _entity.InvokeGoto(target, slot );
+            _entityTaskToken = _entity.InvokeGoto(target, slot);
             PreviousTarget = target;
 
             LogTaskStart(_task, $"Robot goto {target}.{slot + 1}");
@@ -83,7 +83,7 @@ namespace Venus_RT.Scheduler
             return true;
         }
 
-        public bool Map(ModuleName destination )
+        public bool Map(ModuleName destination)
         {
             _entityTaskToken = _entity.InvokeMap(destination.ToString());
             LogTaskStart(_task, $"{Module} mapping");
@@ -133,29 +133,31 @@ namespace Venus_RT.Scheduler
 
         public bool PostMoveItems(MoveItem[] items)
         {
-            foreach (var item in items)
-            {
-                LOG.Write(eEvent.EV_ROUTER, ModuleName.EfemRobot, $"Post Moving Item: {item.SourceModule} Slot {item.SourceSlot + 1} => {item.DestinationModule} Slot {item.DestinationSlot + 1}");
-            }
-
-            if (ModuleHelper.IsLoadLock(items.First().Module))
+            if (items.Length > 0)
             {
                 _currentScheduler = new SchedulerItem();
-                _currentScheduler.MoveType = EfemEntity.MSG.Swap;
-                _currentScheduler.target = items.First().Module;
+                _currentScheduler.moveList = new Queue<MoveItem>();
                 _currentScheduler.Status = RState.Init;
-                _currentScheduler.moveList = new Queue<MoveItem>(items);
-                
-            }
-            else
-            {
-                _currentScheduler = new SchedulerItem();
-                _currentScheduler.MoveType = items.First().TransferType == EnumMoveType.Pick ? EfemEntity.MSG.Pick : EfemEntity.MSG.Place;
-                _currentScheduler.target = items.First().Module;
-                _currentScheduler.Status = RState.Init;
-                _currentScheduler.moveList = new Queue<MoveItem>(items);
-            }
 
+                foreach (var item in items)
+                {
+                    LOG.Write(eEvent.EV_ROUTER, ModuleName.EfemRobot, $"Post Moving Item: {item.SourceModule} Slot {item.SourceSlot + 1} => {item.DestinationModule} Slot {item.DestinationSlot + 1}");
+
+                    if (ModuleHelper.IsLoadLock(item.Module))
+                    {
+                        _currentScheduler.MoveType = EfemEntity.MSG.Swap;
+                        _currentScheduler.target = item.Module;
+                        _currentScheduler.moveList.Enqueue(item);
+
+                    }
+                    else
+                    {
+                        _currentScheduler.MoveType = items.First().TransferType == EnumMoveType.Pick ? EfemEntity.MSG.Pick : EfemEntity.MSG.Place;
+                        _currentScheduler.target = item.Module;
+                        _currentScheduler.moveList.Enqueue(item);
+                    }
+                }
+            }
             RunSchedulers();
             return true;
         }
@@ -167,7 +169,7 @@ namespace Venus_RT.Scheduler
 
             if (_entity.IsIdle)
             {
-                if(_currentScheduler.Status == RState.Init)
+                if (_currentScheduler.Status == RState.Init)
                 {
                     foreach (var item in _currentScheduler.moveList)
                     {
@@ -182,12 +184,12 @@ namespace Venus_RT.Scheduler
                     else
                         _entityTaskToken = (int)FSM_MSG.NONE;
                 }
-                else if(_currentScheduler.Status == RState.Running)
+                else if (_currentScheduler.Status == RState.Running)
                 {
                     if (IsAllWafersArrived())
                     {
-                        if( _entityTaskToken == (int)EfemEntity.MSG.Pick || 
-                            _entityTaskToken == (int)EfemEntity.MSG.Place || 
+                        if (_entityTaskToken == (int)EfemEntity.MSG.Pick ||
+                            _entityTaskToken == (int)EfemEntity.MSG.Place ||
                             _entityTaskToken == (int)EfemEntity.MSG.Swap)
                         {
                             _entityTaskToken = (int)FSM_MSG.NONE;
@@ -203,7 +205,7 @@ namespace Venus_RT.Scheduler
 
         private bool IsAllWafersArrived()
         {
-            foreach(var item in _currentScheduler.moveList)
+            foreach (var item in _currentScheduler.moveList)
             {
                 if (WaferManager.Instance.CheckNoWafer(item.DestinationModule, item.DestinationSlot))
                     return false;
@@ -217,7 +219,7 @@ namespace Venus_RT.Scheduler
             base.ResetTask();
 
             _entityTaskToken = (int)FSM_MSG.NONE;
-            if(_currentScheduler != null)
+            if (_currentScheduler != null)
             {
                 _alignAngle = SC.GetValue<int>($"EFEM.Aligner.AlignAngle");
                 _increasingAngle = SC.GetValue<int>($"EFEM.Aligner.IncreasingAngle");
@@ -233,14 +235,14 @@ namespace Venus_RT.Scheduler
             LogTaskStart(_task, $"Aligning");
 
             _increasingAngle = SC.GetValue<int>($"EFEM.Aligner.IncreasingAngle");
-            if(_increasingAngle == 0)
+            if (_increasingAngle == 0)
             {
                 // enable change align angle only with increasing function disable to avoid logic confuse
                 _alignAngle = SC.GetValue<int>($"EFEM.Aligner.AlignAngle");
             }
 
             _alignAngle = (_alignAngle + _increasingAngle) % 360;
-            _entityTaskToken = _entity.InvokeAlign(ModuleName.Aligner1.ToString(),0, _alignAngle);
+            _entityTaskToken = _entity.InvokeAlign(ModuleName.Aligner1.ToString(), 0, _alignAngle);
 
             return _entityTaskToken == (int)EfemEntity.MSG.Align;
         }

+ 36 - 5
Venus/Venus_Simulator/Instances/SystemConfig.cs

@@ -6,26 +6,57 @@ using System.Linq;
 using Aitex.Core.Util;
 using Aitex.Core.RT.SCCore;
 using Aitex.Core.RT.Log;
+using System.Configuration;
+
 namespace Venus_Simulator.Instances
 {
-    
+
     public class SystemConfig : Singleton<SystemConfig>
     {
         private Dictionary<string, SCConfigItem> _items = new Dictionary<string, SCConfigItem>();
         List<string> paths = new List<string>();
+
+        private string pathName = "";
+        public  Configuration GetConfig(string path)
+        {
+
+            if (!File.Exists(path))
+            {
+                throw new FileNotFoundException(path + "路径下的文件未找到!");
+            }
+            try
+            {
+                ExeConfigurationFileMap configFile = new ExeConfigurationFileMap();
+                configFile.ExeConfigFilename = path;
+                Configuration config = ConfigurationManager.OpenMappedExeConfiguration(configFile, ConfigurationUserLevel.None);
+                return config;
+            }
+            catch (Exception)
+            {
+                throw;
+            }
+        }
         public void Initialize()
         {
             var current_path = Environment.CurrentDirectory;
             int nIndesx = current_path.LastIndexOf("Venus\\");
             current_path = current_path.Substring(0, nIndesx + 5);
-                
+            string rtConfigPath = current_path + "\\Venus_RT\\bin\\Debug\\Venus_RT.exe.config";
+            var pressureType=GetConfig(rtConfigPath).ConnectionStrings.ConnectionStrings["PressureType"].ConnectionString;
+            if (pressureType == "1")
+            {
+                pathName = "_Kepler2200";
+            }
+
+
+
             GetConfigFilePath(current_path);
             string cfgPath = paths.Find(item => item.Contains("Venus_RT"));
             if (cfgPath != null)
             {
                 string config_path = cfgPath;
-                string system_cfg = config_path.Replace("_sc.data", "System.sccfg"); 
-                if(File.Exists(system_cfg))
+                string system_cfg = config_path.Replace($"_sc{pathName}.data", $"System{pathName}.sccfg");
+                if (File.Exists(system_cfg))
                 {
                     BuildItems(system_cfg);
 
@@ -222,7 +253,7 @@ namespace Venus_Simulator.Instances
             FileInfo[] fi = dir.GetFiles();
             foreach (FileInfo f in fi)
             {
-                if (f.FullName.Contains("\\Venus_RT\\") && f.FullName.Contains("\\Config\\") && f.Name == "_sc.data")
+                if (f.FullName.Contains("\\Venus_RT\\") && f.FullName.Contains("\\Config\\") && f.Name == $"_sc{pathName}.data")
                 {
                     paths.Add(f.FullName);
                     return;

+ 1 - 0
Venus/Venus_Simulator/Venus_Simulator.csproj

@@ -49,6 +49,7 @@
     </Reference>
     <Reference Include="PresentationFramework.Aero" />
     <Reference Include="System" />
+    <Reference Include="System.Configuration" />
     <Reference Include="System.Data" />
     <Reference Include="System.ServiceModel" />
     <Reference Include="System.Xml" />