Browse Source

add DE shareChiller && add check items before PM Pump down.

zhouhr 11 months ago
parent
commit
cc436f1ac6

+ 38 - 3
Venus/Venus_RT/Devices/JetVenusDEPM.cs

@@ -244,6 +244,20 @@ namespace Venus_RT.Devices
                     _Chiller = DEVICE.GetDevice<AIRSYSChiller>($"{Module}.{VenusDevice.Chiller}");
                 }
             }
+			else
+            if (SC.GetValue<bool>($"{Module}.Chiller.EnableChiller") &&
+                SC.GetValue<int>($"{Module}.Chiller.CommunicationType") == (int)CommunicationType.RS485 &&
+                SC.GetValue<bool>($"{Module}.Chiller.ShareCOM"))
+            {
+                if (SC.GetValue<int>($"{Module}.Chiller.MFG") == (int)ChillerMFG.SMC)
+                {
+                    _Chiller = DEVICE.GetDevice<SMCShareChiller>($"{Module}.{VenusDevice.Chiller}");
+                }
+                else if (SC.GetValue<int>($"{Module}.Chiller.MFG") == (int)ChillerMFG.AIRSYS)
+                {
+                    _Chiller = DEVICE.GetDevice<AIRSYSChiller>($"{Module}.{VenusDevice.Chiller}");
+                }
+            }
 
 
             // RS232 AdTec Generator
@@ -488,8 +502,22 @@ namespace Venus_RT.Devices
 
         public override bool IsHVOn => _ESCHV.IsOn;
 
-        public override float CoolantInletTempFB => _Chiller.CoolantInletTcFeedback;
-
+        public override float CoolantInletTempFB
+        {
+            get
+            {
+                switch (SC.GetValue<int>($"{Module}.Chiller.CommunicationType"))
+                {
+                    case (int)CommunicationType.RS232:
+                        return _Chiller.CoolantInletTcFeedback;
+                    case (int)CommunicationType.RS485:
+                        return _Chiller.Temperature;
+                    default:
+                        return 0;
+                }
+            }
+        }
+        
         public override float CoolantOutletTempFB => _Chiller.CoolantOutletTcFeedback;
 
         public override bool ChillerIsRunning => _Chiller.IsRunning;
@@ -1232,7 +1260,14 @@ namespace Venus_RT.Devices
         => _MainPump?.SetPumpOnOff(on);
 
         public override bool TurnPendulumValve(bool on)
-        => _pendulumValve.TurnValve(on);
+        {
+            if (on && (!TurboPumpInterlock || !IsCDA_OK || !IsTurboPumpAtSpeed || !IsWLK))
+            {
+                LOG.Write(eEvent.ERR_PENDULUM_VALVE,Module, "Cannot open PendulumValve, as Interlock not arrival");
+                return false;
+            }
+            return _pendulumValve.TurnValve(on);
+        }
 
         public override void TurnTurboPump(bool on)
         {

+ 31 - 3
Venus/Venus_RT/Devices/SMCChillerDrive.cs

@@ -29,6 +29,11 @@ namespace Venus_RT.Devices
     /// ControlTcFeedback:返回值
     /// </summary>
 
+    public enum ChillerMsgType
+    {
+        Get,
+        Set
+    }
     public class SMCChillerDrive
     {
 
@@ -42,6 +47,7 @@ namespace Venus_RT.Devices
 
         private Dictionary<string,string> _address2Module;//不正确 应该以字典的形式 以头去打印
         private Dictionary<string, ChillerData> _addressQuery;
+        private Dictionary<string, Queue<string>> _addressCmdQueue;
         private ModuleName Module;//不正确 应该以字典的形式 以头去打印
 
         // --------------------------Constructor-----------------------
@@ -67,6 +73,7 @@ namespace Venus_RT.Devices
             _address2Module = new Dictionary<string, string>();
             _addressQuery = new Dictionary<string, ChillerData>();
 
+
             Task.Run(() =>
             {
                 foreach (var data in blockingCollection.GetConsumingEnumerable())
@@ -178,6 +185,7 @@ namespace Venus_RT.Devices
 
                                 }
                             }
+                            _addressCmdQueue[header].Dequeue();
                             _addressQuery[header] = chillerdata;
                         }
                         break;
@@ -199,12 +207,31 @@ namespace Venus_RT.Devices
         }
 
 
-        public void SendCmd(string str)
+        public void SendCmd(ChillerMsgType type,string str)
         {
             //消息通用格式:开头 + 内容 + LRC + 结尾
             //_serial?.Write(":" + str + ModbusUtility.CalculateLrc(ModbusUtility.HexToBytes(str)).ToString("X2") + "\r\n");
-            LOG.Write(eEvent.INFO_DEVICE_CHILLER,ModuleName.System, "Send Cmd => :" + str + ModbusUtility.CalculateLrc(ModbusUtility.HexToBytes(str)).ToString("X2"));
-            blockingCollection.Add(":" + str + ModbusUtility.CalculateLrc(ModbusUtility.HexToBytes(str)).ToString("X2") + "\r\n");
+            //如果是设置的直接发出无需等待
+            if (type == ChillerMsgType.Set)
+            {
+                blockingCollection.Add(":" + str + ModbusUtility.CalculateLrc(ModbusUtility.HexToBytes(str)).ToString("X2") + "\r\n");
+            }
+
+            //如果是获取的可以慢一些 在数据回复后继续
+            if (type == ChillerMsgType.Get)
+            {
+
+                //每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");
+
+            }
+
         }
 
         public void AddAddress(string address, string chillertype)
@@ -212,6 +239,7 @@ namespace Venus_RT.Devices
             //address => "02" chillertype => PMA.OutChiller
             _address2Module.Add(address,chillertype);
             _addressQuery.Add(address, new ChillerData());
+            _addressCmdQueue.Add(address, new Queue<string>());
         }
 
         public ChillerData QueryData(string address)

+ 3 - 3
Venus/Venus_RT/Devices/SMCShareChiller.cs

@@ -189,7 +189,7 @@ namespace Venus_RT.Devices
                 {
                     Stopwatch stopwatch = Stopwatch.StartNew();
                     stopwatch.Start();
-                    _driver.SendCmd(message.GET_ALL);
+                    _driver.SendCmd(ChillerMsgType.Get,message.GET_ALL);
                     stopwatch.Stop();
                     LOG.Write(eEvent.INFO_DEVICE_CHILLER, Module, $"Use Time:{stopwatch.ElapsedMilliseconds}");
                     _timerQueryStatus.Start(CHK_ST_INTERVAL);
@@ -253,13 +253,13 @@ namespace Venus_RT.Devices
         public override void SetChillerTemp(float value, float offset)
         {
             int isettemp = Convert.ToInt16((value - offset) * 10);
-            _driver.SendCmd(message.SET_TEMP + isettemp.ToString("X4"));
+            _driver.SendCmd(ChillerMsgType.Set, message.SET_TEMP + isettemp.ToString("X4"));
             _controlTcSetPoint = value;
         }
 
         public override void SetChillerOnOff(bool on)
         {
-            _driver.SendCmd(on ? message.SET_ON : message.SET_OFF);
+            _driver.SendCmd(ChillerMsgType.Set, on ? message.SET_ON : message.SET_OFF);
         }
 
         private void SetAlarmMsg()

+ 22 - 6
Venus/Venus_RT/Modules/PMs/PumpDownRoutine.cs

@@ -4,6 +4,7 @@ using Aitex.Core.RT.SCCore;
 using Venus_RT.Devices;
 using MECF.Framework.Common.Routine;
 using Venus_Core;
+using Aitex.Core.RT.Log;
 
 namespace Venus_RT.Modules.PMs
 {
@@ -15,6 +16,7 @@ namespace Venus_RT.Modules.PMs
             kCloseISOValve,
             kSoftPump,
             kFastPump,
+            kHe2ExDelay,
             kPVHe2,
             kISOValve,
             kTurboN2Purge,
@@ -58,13 +60,17 @@ namespace Venus_RT.Modules.PMs
                 _chamber.OpenValve(ValveType.PVN22, true);
                 _chamber.OpenValve(ValveType.TurboPumpPumping, true);
                 _chamber.TurnPendulumValve(false);
-                //if (jetChamber == JetChamber.Venus)
-                //{
-                //    _chamber.OpenValve(ValveType.HeISO, false);
-                //    _chamber.OpenValve(ValveType.PVHe3, false);
-                //}
+                
                 _vHe2FlowPressure = SC.GetValue<int>($"{Module}.Pump.PumpVHe2FlowPressure");
 
+                //前端压力值高于某个数值
+                if (!_chamber.IsPumpRunning || _chamber.ForelinePressure > 500)
+                {
+                    LOG.Write(eEvent.ERR_PM,Module, $"Cannot start pumpdown, drypump running:{_chamber.IsPumpRunning}, ForelinePressure:{_chamber.ForelinePressure}");
+                    return RState.Failed;
+                }
+                
+
                 return Runner.Start(Module, Name);
             }
 
@@ -105,8 +111,9 @@ namespace Venus_RT.Modules.PMs
                 case JetChamber.VenusDE:
                     Runner.Delay(PumpStep.kDelay_2s, _delay_2s)
                           .Run(PumpStep.kCloseISOValve, HOFs.WrapAction(_chamber.OpenValve, ValveType.TurboPumpPumping, false), _delay_2s)
+                          .Run(PumpStep.kFastPump, OpenDEFastPump, () => { return _chamber.ChamberPressure < _vHe2FlowPressure; })
+                          .Delay(PumpStep.kHe2ExDelay, 3000)
                           .Run(PumpStep.kPVHe2, OpenHe2Valve, _delay_5s)
-                          .Run(PumpStep.kFastPump, OpenFastPump, () => { return _chamber.ChamberPressure < _vHe2FlowPressure; })
                           .Run(PumpStep.kISOValve, OpenISOValve, _delay_5s)
                           .Run(PumpStep.kOpenTurboPump, OpenTurboValve, _delay_3s)
                           .Run(PumpStep.kVATValve, OpenVATValve, _delay_2s)
@@ -171,6 +178,15 @@ namespace Venus_RT.Modules.PMs
             return true;
         }
 
+        private bool OpenDEFastPump()
+        {
+            //_chamber.OpenValve(ValveType.SoftPump, false);
+            _chamber.OpenValve(ValveType.PVHe2, false);
+            _chamber.OpenValve(ValveType.FastPump, true);
+
+            return true;
+        }
+
         private bool OpenHe2Valve()
         {
             _chamber.OpenValve(ValveType.FastPump, false);