Browse Source

1.FinsPlc Do 写之前读一次
2.资源监控增加EfemDualUI
3. Operation Log,Data History,Data Charting 增加UI占用内存
4.Cassette removed 报一次日志以及 tm robot如果2个手臂都有wafer,选择和腔里面相同的一个

JET-YDB\JET-YANGDB 6 months ago
parent
commit
f19a4dc70f

+ 12 - 1
FrameworkLocal/Common/IOCore/IoProvider.cs

@@ -60,7 +60,10 @@ namespace MECF.Framework.RT.Core.IoProviders
         protected virtual void WriteAoFloat(int offset, float[] buffer)
         {
         }
-
+        protected virtual bool[] ReadDO(int offset, int size)
+        {
+            return null;
+        }
         /// <summary>
         /// 单腔体
         /// </summary>
@@ -188,6 +191,14 @@ namespace MECF.Framework.RT.Core.IoProviders
                                 }
                             }
                         }
+                        else if (bufferSection.Type == IoType.DO)
+                        {
+                            bool[] doBuffer = ReadDO(bufferSection.Offset, bufferSection.Size);
+                            if (doBuffer != null && doBuffer.Length > 0)
+                            {
+                                _buffer.SetDoBuffer(_source, bufferSection.Offset, doBuffer);
+                            }
+                        }
                     }
 
 

+ 30 - 0
FrameworkLocal/Common/PLC/FinsPlc.cs

@@ -53,6 +53,7 @@ namespace MECF.Framework.Common.PLC
         byte[] Client, Server;
 
         private bool _isOpened = false;
+        private bool _isDOLoaded = false;
 
         private string _ip = "192.168.10.10";
         private int _port = 9600;
@@ -518,6 +519,35 @@ namespace MECF.Framework.Common.PLC
             return null;
         }
 
+        protected override bool[] ReadDO(int offset, int size)
+        {
+            if (_isDOLoaded) return null;
+
+            _isDOLoaded = true;
+            _timerRead.Start(0);
+            try
+            {
+                LOG.Info($"{Module} {Name} PLC ({_ip}) start read DO");
+                byte[] data = new byte[200];
+                ReadBlock<byte>(_doBlockType, (ushort)_doBlockStartPosition, (ushort)data.Length, ref data);
+                LOG.Info($"{Module} {Name} PLC ({_ip}) end read DO,result={string.Join(",", data)}");
+                return Array.ConvertAll(data, x => x == 1);
+            }
+            catch (Exception ex)
+            {
+                double interval = _timerRead.GetElapseTime();
+                string detail = string.Empty;
+                if (_receiveTimeout > 0 && _receiveTimeout <= interval)
+                {
+                    detail = $"(timeout:{_receiveTimeout} ms, read time:{interval} ms)";
+                }
+                LOG.Error($"PLC ({_ip}) Read DO exception{detail}.", ex);
+                EV.PostMessage("System", EventEnum.DefaultWarning, "PLC Read DO exception");
+                Close();
+            }
+            return null;
+        }
+
         protected override short[] ReadAi(int offset, int size)
         {
             _timerRead.Start(0);

+ 18 - 2
FrameworkLocal/UIClient/ClientViews/DataLogs/DataHistory/DataViewModel.cs

@@ -153,7 +153,7 @@ namespace MECF.Framework.UI.Client.CenterViews.DataLogs.DataHistory
             VisibleRangeTime = new DateRange(DateTime.Now.AddMinutes(60), DateTime.Now.AddMinutes(-60));
             VisibleRangeValue = new DoubleRange(0, 10);
 
-            _thread = new PeriodicJob(200, MonitorData, "RealTime", true);
+            _thread = new PeriodicJob(200, MonitorData, "RealTime");
         }
 
         protected override void OnViewLoaded(object _view)
@@ -167,7 +167,23 @@ namespace MECF.Framework.UI.Client.CenterViews.DataLogs.DataHistory
         protected override void OnActivate()
         {
             base.OnActivate();
-
+            ParameterNodes = _provider.GetParameters();
+            _thread.Start();
+        }
+        protected override void OnDeactivate(bool close)
+        {
+            base.OnDeactivate(close);
+            if (_provider != null) _provider.Clear();
+            if (SelectedData != null && SelectedData.Count > 0)
+            {
+                foreach (var item in SelectedData)
+                {
+                    var seriesItem = item as ChartDataLine;
+                    if (seriesItem != null) seriesItem.ClearData();
+                }
+                SelectedData.Clear();
+            }
+            _thread.Pause();
         }
 
         protected bool MonitorData()

+ 7 - 2
FrameworkLocal/UIClient/ClientViews/DataLogs/Event/EventViewModel.cs

@@ -1,5 +1,6 @@
 using Aitex.Core.RT.Event;
 using Aitex.Core.RT.Log;
+using Aitex.Core.Utilities;
 using MECF.Framework.Common.DataCenter;
 using MECF.Framework.Common.Utilities;
 using MECF.Framework.UI.Client.ClientBase;
@@ -56,7 +57,7 @@ namespace MECF.Framework.UI.Client.CenterViews.DataLogs.Event
 
     public class EventViewModel : BaseModel
     {
-
+        private Dictionary<EventLevel, BitmapImage> _bitmapImageByEventLevel;
         public bool SearchAlarmEvent { get; set; }
         public bool SearchWarningEvent { get; set; }
         public bool SearchInfoEvent { get; set; }
@@ -213,6 +214,10 @@ namespace MECF.Framework.UI.Client.CenterViews.DataLogs.Event
             PageInfo = "0/0";
 
             NavigateCommand = new BaseCommand<string>((o) => Navigate(o), (o) => true);
+            _bitmapImageByEventLevel = new Dictionary<EventLevel, BitmapImage>();
+            EnumLoop<EventLevel>.ForEach(p=> {
+                _bitmapImageByEventLevel[p] = new BitmapImage(new Uri(string.Format("pack://application:,,,/MECF.Framework.UI.Core;component/Resources/SystemLog/{0}.png", p.ToString()), UriKind.Absolute));
+            });
         }
 
         protected override void OnInitialize()
@@ -576,7 +581,7 @@ namespace MECF.Framework.UI.Client.CenterViews.DataLogs.Event
                             Detail = ev.Description,
                             TargetChamber = ev.Source,
                             Initiator = "",
-                            Icon = new BitmapImage(new Uri(string.Format("pack://application:,,,/MECF.Framework.UI.Core;component/Resources/SystemLog/{0}.png", ev.Level.ToString()), UriKind.Absolute))
+                            Icon = _bitmapImageByEventLevel[ev.Level]
                         });
                     }
                     NotifyOfPropertyChange("SearchedResult");

+ 17 - 6
FrameworkLocal/UIClient/ClientViews/Operations/RealTime/RealTimeViewModel.cs

@@ -93,21 +93,32 @@ namespace MECF.Framework.UI.Client.CenterViews.Operations.RealTime
             TimeSpanSaved = true;
             TrendTimeSpan = 60*5;
 
-            _thread = new PeriodicJob(TrendInterval, MonitorData, "RealTime", true);
+            _thread = new PeriodicJob(TrendInterval, MonitorData, "RealTime");
             _pointCount = Math.Max( TrendTimeSpan*1000 / TrendInterval, 10);
         }
 
         protected override void OnActivate()
         {
             base.OnActivate();
+            _thread.Start();
             //_provider.Clear();
             //_thread = new PeriodicJob(100, MonitorData, "RealTime", true);
         }
-        //protected override void OnDeactivate(bool close)
-        //{
-        //    base.OnDeactivate(close);
-        //    _thread.Stop();
-        //}
+        protected override void OnDeactivate(bool close)
+        {
+            base.OnDeactivate(close);
+            if (_provider != null) _provider.Clear();
+            if(SelectedData != null && SelectedData.Count > 0)
+            {
+                foreach(var item in SelectedData)
+                {
+                    var seriesItem = item as ChartDataLine;
+                    if (seriesItem != null) seriesItem.ClearData();
+                }
+                SelectedData.Clear();
+            }
+            _thread.Pause();
+        }
         protected bool MonitorData()
         {
             try

+ 7 - 4
Mars/EfemDualRT/Resources/ResourceMonitor.cs

@@ -21,6 +21,7 @@ namespace EfemDualRT.Resources
     public class ResourceMonitor
     {
         private string processRTname = Process.GetCurrentProcess().ProcessName;
+        private string processUIname = "EfemDualUI";
         private int threshold = 800;
         private Process pro;
         private string Response = string.Empty;
@@ -88,9 +89,9 @@ namespace EfemDualRT.Resources
             if (checkInterval > 0)
             {
                 InitNetAdapter();
-                _readDisk = new PerformanceCounter("PhysicalDisk", "Avg. Disk sec/Read", "0 C: D:");
-                _writeDisk = new PerformanceCounter("PhysicalDisk", "Avg. Disk sec/Write", "0 C: D:");
-                _transferDisk = new PerformanceCounter("PhysicalDisk", "Avg. Disk sec/Transfer", "0 C: D:");
+                _readDisk = new PerformanceCounter("PhysicalDisk", "Avg. Disk sec/Read", "_Total");
+                _writeDisk = new PerformanceCounter("PhysicalDisk", "Avg. Disk sec/Write", "_Total");
+                _transferDisk = new PerformanceCounter("PhysicalDisk", "Avg. Disk sec/Transfer", "_Total");
                 CpuOccupied = new PerformanceCounter("Processor", "% Processor Time", "_Total");
                 _thread = new PeriodicJob(checkInterval, GetProcessInfo, "ResourceMonitor", true);
             }
@@ -129,6 +130,7 @@ namespace EfemDualRT.Resources
             try
             {
                 string rtmonoitor = process_use(processRTname);
+                string uimonoitor = process_use(processUIname);
 
                 string systemMonitor = $"PC => {drive_use()}" +
                     $"{cpu_use()}" +
@@ -143,7 +145,8 @@ namespace EfemDualRT.Resources
                     sbNetInfo.Append($"Bytes Received/sec:{perCounter[1].NextValue()} b/s ");
                 }
                 var diskInfo = $"Avg. Disk sec/Read:{_readDisk.NextValue()} Avg. Disk sec/Write:{_writeDisk.NextValue()} Avg.Disk sec/Transfer:{_transferDisk.NextValue()}";
-                LOG.Write($"{ModuleName.System} ResourceMonitor Process Info: [{rtmonoitor}] ");
+                LOG.Write($"{ModuleName.System} ResourceMonitor RT Process Info: [{rtmonoitor}] ");
+                LOG.Write($"{ModuleName.System} ResourceMonitor UI Process Info: [{uimonoitor}] ");
                 LOG.Write($"{ModuleName.System} ResourceMonitor System Info:  [{systemMonitor}]  ");
                 LOG.Write($"{ModuleName.System} ResourceMonitor Network Info: [{sbNetInfo.ToString()}] ");
                 LOG.Write($"{ModuleName.System} ResourceMonitor Disk Read/Write Info: [{diskInfo}] ");

+ 47 - 12
Mars/EfemDualSchedulerLib/AutoTransfer.cs

@@ -69,6 +69,7 @@ namespace EfemDualSchedulerLib
         private R_TRIG _trigLp1JobComplete = new R_TRIG();
         private R_TRIG _trigLp2JobComplete = new R_TRIG();
         private R_TRIG _trigLp3JobComplete = new R_TRIG();
+        private Dictionary<ModuleName, R_TRIG> _checkNoCarrierByModule = new Dictionary<ModuleName, R_TRIG>();
 
         private Dictionary<string, float> _temperatureSetpointDic = new Dictionary<string, float>();
         private Dictionary<string, R_TRIG> _temperatureTrigDic = new Dictionary<string, R_TRIG>();
@@ -319,11 +320,20 @@ namespace EfemDualSchedulerLib
                 _lstCoolings.Add(_cooling2);
 
             if (SC.GetValueOrDefault<bool>("System.SetUp.LP1.IsInstalled"))
+            {
                 _lstLps.Add(_lp1);
+                _checkNoCarrierByModule[_lp1.Module] = new R_TRIG();
+            }
             if (SC.GetValueOrDefault<bool>("System.SetUp.LP2.IsInstalled"))
+            {
                 _lstLps.Add(_lp2);
+                _checkNoCarrierByModule[_lp2.Module] = new R_TRIG();
+            }
             if (SC.GetValueOrDefault<bool>("System.SetUp.LP3.IsInstalled"))
+            {
                 _lstLps.Add(_lp3);
+                _checkNoCarrierByModule[_lp3.Module] = new R_TRIG();
+            }
             _pmSwapWaitTimeOut.Clear();
             _lstPms.ForEach(p=>_pmSwapWaitTimeOut[p.Module] = new Tuple<R_TRIG, DeviceTimer>(new R_TRIG(),new DeviceTimer()));
             //临时办法,设备异常后进行reset,重新home后reset机械手task
@@ -2746,9 +2756,10 @@ namespace EfemDualSchedulerLib
                     if (!string.IsNullOrEmpty(cj.Module))
                     {
                         var lp = GetModule(cj.Module);
-                        if (CarrierManager.Instance.CheckNoCarrier(lp.Module, 0))
+                        _checkNoCarrierByModule[lp.Module].CLK = CarrierManager.Instance.CheckNoCarrier(lp.Module, 0);
+                        if (_checkNoCarrierByModule[lp.Module].Q)
                         {
-                            EV.PostAlarmLog("System", "Cassette removed while job not finished.");
+                            EV.PostAlarmLog(lp.Module.ToString(), "Cassette removed while job not finished.");
 
                             //Singleton<RouteManager>.Instance.PostMsg(RouteManager.MSG.ERROR);
                         }
@@ -3585,9 +3596,11 @@ namespace EfemDualSchedulerLib
                             return;
 
                         int placeSlot = 1;
-                        if (WaferManager.Instance.CheckNoWafer(schedulerPm.Module, placeSlot)
-                            && CheckCanPlaceWaferToPM(schedulerPm.Module, placeSlot, WaferManager.Instance.GetWafer(ModuleName.TMRobot, (int)placeBlade)))
+                        if (WaferManager.Instance.CheckNoWafer(schedulerPm.Module, placeSlot))
                         {
+                            if (!GetSameRecipeNameByHand(schedulerPm, placeSlot, out Hand newPlaceBlade))
+                                return;
+                            placeBlade = newPlaceBlade;
                             if (_PMA2Disabled)
                                 return;
 
@@ -3609,10 +3622,11 @@ namespace EfemDualSchedulerLib
                             return;
 
                         int placeSlot = 0;
-                        if (WaferManager.Instance.CheckNoWafer(schedulerPm.Module, placeSlot)
-                            && CheckCanPlaceWaferToPM(schedulerPm.Module, placeSlot, WaferManager.Instance.GetWafer(ModuleName.TMRobot, (int)placeBlade)))
+                        if (WaferManager.Instance.CheckNoWafer(schedulerPm.Module, placeSlot))
                         {
-
+                            if (!GetSameRecipeNameByHand(schedulerPm, placeSlot, out Hand newPlaceBlade))
+                                return;
+                            placeBlade = newPlaceBlade;
                             if (_PMA1Disabled)
                                 return;
 
@@ -3729,9 +3743,11 @@ namespace EfemDualSchedulerLib
                             return;
 
                         int placeSlot = 1;
-                        if (WaferManager.Instance.CheckNoWafer(schedulerPm.Module, placeSlot)
-                            && CheckCanPlaceWaferToPM(schedulerPm.Module, placeSlot, wafer))
+                        if (WaferManager.Instance.CheckNoWafer(schedulerPm.Module, placeSlot))
                         {
+                            if (!GetSameRecipeNameByHand(schedulerPm, placeSlot, out Hand newPlaceBlade))
+                                return;
+                            placeBlade = newPlaceBlade;
                             if (_PMB2Disabled)
                                 return;
 
@@ -3753,10 +3769,11 @@ namespace EfemDualSchedulerLib
                             return;
 
                         int placeSlot = 0;
-                        if (WaferManager.Instance.CheckNoWafer(schedulerPm.Module, placeSlot)
-                            && CheckCanPlaceWaferToPM(schedulerPm.Module, placeSlot, wafer))
+                        if (WaferManager.Instance.CheckNoWafer(schedulerPm.Module, placeSlot))
                         {
-
+                            if (!GetSameRecipeNameByHand(schedulerPm, placeSlot, out Hand newPlaceBlade))
+                                return;
+                            placeBlade = newPlaceBlade;
                             if (_PMB1Disabled)
                                 return;
 
@@ -3777,6 +3794,24 @@ namespace EfemDualSchedulerLib
 
         }
 
+        private bool GetSameRecipeNameByHand(SchedulerPM schedulerPm, int placeSlot, out Hand placeHand)
+        {
+            placeHand = Hand.Blade1;
+            if (_tmRobot.Blade1Enable && CheckHasWaferAndNeedProcess(Hand.Blade1) && 
+                CheckCanPlaceWaferToPM(schedulerPm.Module, placeSlot, WaferManager.Instance.GetWafer(ModuleName.TMRobot, (int)Hand.Blade1)))
+            {
+                placeHand = Hand.Blade1;
+                return true;
+            }
+            else if (_tmRobot.Blade2Enable && CheckHasWaferAndNeedProcess(Hand.Blade2) && 
+                CheckCanPlaceWaferToPM(schedulerPm.Module, placeSlot, WaferManager.Instance.GetWafer(ModuleName.TMRobot, (int)Hand.Blade2)))
+            {
+                placeHand = Hand.Blade2;
+                return true;
+            }
+            return false;
+        }
+
         private void MonitorTmRobotPMAPickTask()
         {
             if (!_tmRobot.IsAvailable)