ソースを参照

fix bugs in ShareDrive && add Online in SETM

zhouhr 1 年間 前
コミット
5836f3ed1c

+ 16 - 0
Venus/Venus_MainPages/ViewModels/RecipeViewModel.cs

@@ -1371,6 +1371,22 @@ namespace Venus_MainPages.ViewModels
                                                 var data8 = (AITMfcData)QueryDataClient.Instance.Service.GetData($"{ModuleName}.MfcGas8");
                                                 TextBoxMaxValue.SetMaxValue(textBox, (int)data8.Scale);
                                                 break;
+                                            case "Gas9":
+                                                var data9 = (AITMfcData)QueryDataClient.Instance.Service.GetData($"{ModuleName}.MfcGas9");
+                                                TextBoxMaxValue.SetMaxValue(textBox, (int)data9.Scale);
+                                                break;
+                                            case "Gas10":
+                                                var data10 = (AITMfcData)QueryDataClient.Instance.Service.GetData($"{ModuleName}.MfcGas10");
+                                                TextBoxMaxValue.SetMaxValue(textBox, (int)data10.Scale);
+                                                break;
+                                            case "Gas11":
+                                                var data11 = (AITMfcData)QueryDataClient.Instance.Service.GetData($"{ModuleName}.MfcGas11");
+                                                TextBoxMaxValue.SetMaxValue(textBox, (int)data11.Scale);
+                                                break;
+                                            case "Gas12":
+                                                var data12 = (AITMfcData)QueryDataClient.Instance.Service.GetData($"{ModuleName}.MfcGas12");
+                                                TextBoxMaxValue.SetMaxValue(textBox, (int)data12.Scale);
+                                                break;
 
 
                                         }

+ 25 - 1
Venus/Venus_MainPages/ViewModels/SETMOperationViewModel.cs

@@ -44,6 +44,7 @@ namespace Venus_MainPages.ViewModels
         private bool m_VCEIsVAC;
         private bool m_VCEIsATM;
         private int m_GoToSlotNumber;
+        private bool m_TMIsOnline;
 
         private Dictionary<string, object> m_RtDataValues = new Dictionary<string, object>();
 
@@ -73,6 +74,7 @@ namespace Venus_MainPages.ViewModels
         public bool PMBIsInstalled { get => m_PMBIsInstalled; set => SetProperty(ref m_PMBIsInstalled, value); }
         public bool PMCIsInstalled { get => m_PMCIsInstalled; set => SetProperty(ref m_PMCIsInstalled, value); }
         public bool VCEIsInstalled { get => m_VCEIsInstalled; set => SetProperty(ref m_VCEIsInstalled, value); }
+        //public bool TMIsOnline { get => m_TMIsOnline; set => SetProperty(ref m_TMIsOnline, value); }
 
 
         public int GoToSlotNumber { get => m_GoToSlotNumber; set => SetProperty(ref m_GoToSlotNumber, value); }
@@ -82,7 +84,7 @@ namespace Venus_MainPages.ViewModels
             set { SetProperty(ref m_RtDataValues, value); }
         }
 
-        public bool TMIsOFFline => true;
+        //public bool TMIsOFFline => !TMIsOnline;
 
         public bool VCEDoorIsOpen { get => m_VCEDoorIsOpen; set => SetProperty(ref m_VCEDoorIsOpen, value); }
         public bool PMADoorIsOpen { get => m_PMADoorIsOpen; set => SetProperty(ref m_PMADoorIsOpen, value); }
@@ -184,6 +186,14 @@ namespace Venus_MainPages.ViewModels
         public DelegateCommand Abort =>
             _abort ?? (_abort = new DelegateCommand(abort));
 
+        private DelegateCommand _TMSetOnline;
+        public DelegateCommand TMSetOnline =>
+            _TMSetOnline ?? (_TMSetOnline = new DelegateCommand(TmSetOnline));
+
+        private DelegateCommand _TMSetOffline;
+        public DelegateCommand TMSetOffline =>
+            _TMSetOffline ?? (_TMSetOffline = new DelegateCommand(TmSetOffline));
+
 
         private DelegateCommand _VCEHome;
         public DelegateCommand VCEHome => _VCEHome ?? (_VCEHome = new DelegateCommand(vceHome));
@@ -214,6 +224,8 @@ namespace Venus_MainPages.ViewModels
 
             m_RtDataKeys.Add($"SETM.TMIsATM");
             m_RtDataKeys.Add($"SETM.VCEIsATM");
+            m_RtDataKeys.Add($"SETM.IsOnline");
+            m_RtDataKeys.Add($"SETM.IsOffline");
 
             m_RtDataKeys.Add($"SETM.PumpIsRunning");
             //m_RtDataKeys.Add($"SETM.VCEPipelinePressure.Value");
@@ -248,7 +260,19 @@ namespace Venus_MainPages.ViewModels
             TMIsATM =  CommonFunction.GetValue<bool>(RtDataValues, "SETM.TMIsATM");
             VCEIsVAC = (CommonFunction.GetValue<int>(RtDataValues, "SETM.VCEPressure.Value") < Convert.ToInt32(QueryDataClient.Instance.Service.GetConfig($"VCE1.VACTargetPressure")));
             VCEIsATM = CommonFunction.GetValue<bool>(RtDataValues, "SETM.VCEIsATM");
+            //TMIsOnline = CommonFunction.GetValue<bool>(RtDataValues, "SETM.IsOnline");
+        }
+
+        private void TmSetOnline()
+        {
+            InvokeClient.Instance.Service.DoOperation("SETM.SetOnline");
         }
+
+        private void TmSetOffline()
+        {
+            InvokeClient.Instance.Service.DoOperation("SETM.SetOffline");
+        }
+
         private void vceHome()
         {
             InvokeClient.Instance.Service.DoOperation("VCE1.HOME");

+ 2 - 2
Venus/Venus_MainPages/Views/SETMOperationView.xaml

@@ -402,8 +402,8 @@
                                         <RowDefinition Height="*"></RowDefinition>
                                         <RowDefinition Height="*"></RowDefinition>
                                     </Grid.RowDefinitions>
-                                    <Button  Grid.Row="0" Margin="2">Online</Button>
-                                    <Button  Grid.Row="1" Margin="2">Offline</Button>
+                                    <Button  Grid.Row="0" Margin="2" IsEnabled="{Binding RtDataValues[SETM.IsOffline],Mode=TwoWay}" Command="{Binding TMSetOnline}">Online</Button>
+                                    <Button  Grid.Row="1" Margin="2" IsEnabled="{Binding RtDataValues[SETM.IsOnline],Mode=TwoWay}" Command="{Binding TMSetOffline}">Offline</Button>
                                     <Button  Grid.Row="2" Margin="2"  Command="{Binding TmHome}">Home</Button>
                                     <Button  Grid.Row="3" Margin="2"  Command="{Binding Abort}">Abort</Button>
                                 </Grid>

+ 7 - 6
Venus/Venus_RT/Devices/SMCChillerDrive.cs

@@ -72,7 +72,7 @@ namespace Venus_RT.Devices
 
             _address2Module = new Dictionary<string, string>();
             _addressQuery = new Dictionary<string, ChillerData>();
-
+            _addressCmdQueue = new Dictionary<string, Queue<string>>();
 
             Task.Run(() =>
             {
@@ -223,11 +223,12 @@ namespace Venus_RT.Devices
 
                 //每interval获取温度 超过一秒时效性失去意义 500 * 2积累太多数据 同时注意其是与monitor紧密联系的 实际上是每interval就会进来可能导致数组变大
                 //因此每次进来要控制规模 > 2 时 实时性已经失去此时应该等待回复并把头前的清除掉 而且要注意 chiller本身升温很慢 界面上ramp不明显
-                _addressCmdQueue[str.Substring(1, 2)].Enqueue(str);
-                if (_addressCmdQueue[str.Substring(1, 2)].Count > 2)
-                    _addressCmdQueue[str.Substring(1, 2)].Dequeue();
-                else
-                    blockingCollection.Add(":" + _addressCmdQueue[str.Substring(1, 2)].Peek() + ModbusUtility.CalculateLrc(ModbusUtility.HexToBytes(str)).ToString("X2") + "\r\n");
+                _addressCmdQueue[str.Substring(0, 2)].Enqueue(str);
+                if (_addressCmdQueue[str.Substring(0, 2)].Count > 2)
+                    _addressCmdQueue[str.Substring(0, 2)].Dequeue();
+                
+                if(_addressCmdQueue[str.Substring(0, 2)].Count != 0)
+                    blockingCollection.Add(":" + _addressCmdQueue[str.Substring(0, 2)].Peek() + ModbusUtility.CalculateLrc(ModbusUtility.HexToBytes(str)).ToString("X2") + "\r\n");
 
             }
 

+ 3 - 1
Venus/Venus_RT/Devices/TM/HongHuTM.cs

@@ -201,13 +201,15 @@ namespace Venus_RT.Devices
         public double TMPressure => _TMPressure.Value;
         public double VCEPressure => _VCEPressure.Value;
 
-        enum PumpState
+        public enum PumpState
         {
             Idle,
             TMUsing,
             VCEUsing,
         }
 
+        public PumpState PumpingState => _PumpingState;
+
         PumpState _PumpingState = PumpState.Idle;
 
         #endregion

+ 36 - 68
Venus/Venus_RT/Modules/TM/VenusEntity/SETMEntity.cs

@@ -20,6 +20,7 @@ using Venus_RT.Devices;
 using Venus_RT.Devices.PreAligner;
 using Venus_RT.Devices.VCE;
 using Venus_RT.Modules.PMs;
+using static Mono.Security.X509.X520;
 
 namespace Venus_RT.Modules.TM.VenusEntity
 {
@@ -141,7 +142,9 @@ namespace Venus_RT.Modules.TM.VenusEntity
                     return RState.Running;
             }
         }
-        public bool IsOnline { get; internal set; }
+
+        private bool _IsOnline;
+        public bool IsOnline => _IsOnline;
 
         //public bool IsTMVac => _tm.IsTMVac;
         //public bool IsTMATM => _tm.IsTMATM;
@@ -210,6 +213,8 @@ namespace Venus_RT.Modules.TM.VenusEntity
             DATA.Subscribe("SETM.RobotMoveAction.ArmTarget", () => _robot.TMRobotMoveInfo.ArmTarget.ToString(), SubscriptionAttribute.FLAG.IgnoreSaveDB);
             DATA.Subscribe("SETM.RobotMoveAction.BladeTarget", () => _robot.TMRobotMoveInfo.BladeTarget, SubscriptionAttribute.FLAG.IgnoreSaveDB);
             DATA.Subscribe("SETM.RobotMoveAction.RobotAction", () => _robot.TMRobotMoveInfo.Action.ToString(), SubscriptionAttribute.FLAG.IgnoreSaveDB);
+            DATA.Subscribe("SETM.IsOnline", () => IsOnline, SubscriptionAttribute.FLAG.IgnoreSaveDB);
+            DATA.Subscribe("SETM.IsOffline", () => !IsOnline, SubscriptionAttribute.FLAG.IgnoreSaveDB);
 
             OP.Subscribe("SETM.Goto", (cmd, args) => RobotGoto(args));
             OP.Subscribe("SETM.Home", (cmd, args) => { PostMsg(MSG.Home); return true; });
@@ -223,6 +228,20 @@ namespace Venus_RT.Modules.TM.VenusEntity
             OP.Subscribe("SETM.PMPlace", (cmd, args) => { PostMsg(MSG.PMPlace, args); return true; });
             OP.Subscribe("SETM.PumpDown", (cmd, args) => { PostMsg(MSG.Pump); return true; });
             OP.Subscribe("SETM.Vent", (cmd, args) => { PostMsg(MSG.Vent); return true; });
+            OP.Subscribe("SETM.SetOnline", (cmd, args) =>
+            {
+                if (IsIdle)
+                    _IsOnline = true;
+                else
+                    LOG.Write(eEvent.WARN_TM,ModuleName.TM,"cannot Set Online as TM is not idle");
+
+                return true;
+            });
+            OP.Subscribe("SETM.SetOffline", (cmd, args) =>
+            {
+                _IsOnline = false;
+                return true;
+            });
             return true;
         }
 
@@ -608,74 +627,23 @@ namespace Venus_RT.Modules.TM.VenusEntity
 
         private bool ControlPressureTimer_Elapsed(object[] param)
         {
-            // robot is idle
-
-            // not atmmode
-            //if (RouteManager.IsATMMode)
-            //{
-            //    return true;
-            //}
-            //
-            //if (true)
-            //{
-            //    if (startControlPressureFlag == true)
-            //    {
-            //        //_tmControlPressureRoutine.Start(param);
-            //        _controlPressureCheckPoint = SC.GetValue<int>($"SETM.ControlPressureCheckPoint");
-            //        _controlPressureSetPoint = SC.GetValue<int>($"SETM.ControlPressureSetPoint");
-            //        _controlFlowSetPoint = SC.GetValue<int>($"SETM.TM_MFC1.DefaultSetPoint");
-            //        startControlPressureFlag = false;
-            //        stopControlPressureFlag = false;
-            //        _pumpRoutine.Start();
-            //    }
-            //    RState ret = _pumpRoutine.Monitor();
-            //    if (ret == RState.End && _tm.ChamberPressure <= _controlPressureCheckPoint)
-            //    {
-            //        if (stopControlPressureFlag == false)
-            //        {
-            //            stopControlPressureFlag = true;
-            //            _tm.TurnFastPumpValve(ModuleName.TM, true);
-            //            //_tm.TurnN2Valve(true);
-            //            //_tm.TurnPurgeValve(ModuleName.TM, true);
-            //            if (_tm.AllPMSlitDoorClosed)
-            //            {
-            //                _tm.SwitchTMPressureMode(true);
-            //                _tm.SetTMPressure(_controlPressureSetPoint);
-            //            }
-            //            else
-            //            {
-            //                _tm.SwitchTMPressureMode(false);
-            //                _tm.SetTMFlow(_controlFlowSetPoint);
-            //            }
-            //            if (_tm.PMASlitDoorClosed == false || _tm.PMBSlitDoorClosed == false || _tm.PMCSlitDoorClosed == false || _tm.PMDSlitDoorClosed == false)
-            //            {
-            //                _tm.SwitchTMPressureMode(false);
-            //            }
-            //            else
-            //            {
-            //                _tm.SwitchTMPressureMode(true);
-            //            }
-            //        }
-            //
-            //    }
-            //}
-            //else
-            //{
-            //    if (stopControlPressureFlag == true)
-            //    {
-            //        _tm.TurnFastPumpValve(ModuleName.TM, false);
-            //        //_tm.TurnN2Valve(false);
-            //        //_tm.TurnPurgeValve(ModuleName.TM, false);
-            //        //_tm.SetTMPressure(0);
-            //        _tm.SetTMFlow(0);
-            //        //startControlPressureFlag = true;
-            //        //stopControlPressureFlag = false;
-            //    }
-            //
-            //    startControlPressureFlag = true;
-            //    stopControlPressureFlag = false;
-            //}
+            if (RouteManager.IsATMMode)
+                return true;
 
+            if (IsOnline && _tm.PumpingState == HongHuTM.PumpState.Idle)
+            {
+                if (SC.GetValue<bool>($"SETM.PressureControl.ControlWriteMode"))
+                {
+                    SC.SetItemValue("SETM.PressureControl.ControlWriteMode",false);
+                }
+            }
+            else
+            {
+                if (!SC.GetValue<bool>($"SETM.PressureControl.ControlWriteMode"))
+                {
+                    SC.SetItemValue("SETM.PressureControl.ControlWriteMode", true);
+                }
+            }
 
             return true;
         }