Browse Source

DEVICE UPDATE

sangwq 2 years ago
parent
commit
3f8df8cade

+ 22 - 16
Venus/Venus_RT/Devices/AdixenTurboPump.cs

@@ -170,6 +170,8 @@ namespace Venus_RT.Devices
         private readonly int _internal_parameters_length = 78;
         private readonly AsyncSerialPort _serial;
         private Stopwatch _queryWatch = new Stopwatch();
+        private Stopwatch _responseWatch = new Stopwatch();
+        private readonly int _readInterval = 1000;
         private ConcurrentQueue<Operation> _queCommands = new ConcurrentQueue<Operation>();
 
         private Operation _lastCommand = Operation.Invalid;
@@ -206,26 +208,30 @@ namespace Venus_RT.Devices
 
         public override void Monitor()
         {
-            if(_lastCommand == Operation.Invalid)
+            if(_queryWatch.ElapsedMilliseconds > _readInterval)
             {
-                if(_queCommands.IsEmpty)
+                _queryWatch.Restart();
+                if (_lastCommand == Operation.Invalid)
                 {
-                    _sendCommand(Operation.GetIntervalParametersState);
-                }
-                else
-                {
-                    Operation command;
-                    if(_queCommands.TryDequeue(out command))
+                    if (_queCommands.IsEmpty)
+                    {
+                        _sendCommand(Operation.GetIntervalParametersState);
+                    }
+                    else
                     {
-                        _sendCommand(command);
-                        _lastCommand = command;
+                        Operation command;
+                        if (_queCommands.TryDequeue(out command))
+                        {
+                            _sendCommand(command);
+                            _lastCommand = command;
+                        }
                     }
                 }
-            }
-            else if(_queryWatch.ElapsedMilliseconds > _timeout)
-            {
-                _serial.ClearPortBuffer();
-                _lastCommand = Operation.Invalid;
+                else if (_responseWatch.ElapsedMilliseconds > _timeout)
+                {
+                    _serial.ClearPortBuffer();
+                    _lastCommand = Operation.Invalid;
+                }
             }
         }
 
@@ -368,7 +374,7 @@ namespace Venus_RT.Devices
 
         private bool _sendCmd(string cmd)
         {
-            _queryWatch.Restart();
+            _responseWatch.Restart();
             return _serial.Write(cmd);
         }
 

+ 7 - 7
Venus/Venus_RT/Devices/CometRF.cs

@@ -323,7 +323,7 @@ namespace Venus_RT.Devices
             //SetPowerOnOff(false, out _);
             Status = GeneratorStatus.ERROR;
             StatusMatch = GeneratorStatus.ERROR;
-            //LOG.Error($"{Module} Comet RF Error {args.Reason}");
+            LOG.Write(eEvent.ERR_RF,Module, $"{Module} Comet RF Error {args.Reason}");
         }
 
         public override bool Initialize()
@@ -463,13 +463,13 @@ namespace Venus_RT.Devices
                 if (recTransactionNumber != TransactionNumber)
                 {
                     if (!SC.GetValue<bool>("System.IsSimulatorMode"))
-                        //LOG.Error($"RF transaction number is different");
+                        LOG.Write(eEvent.ERR_RF, Module, $"RF transaction number is different");
                     return;
                 }
 
                 if (rawMessage[6] != _address)
                 {
-                    //LOG.Error($"RF invalid address byte");
+                    LOG.Write(eEvent.ERR_RF, Module, $"RF invalid address byte");
                 }
 
                 if (rawMessage[7] == _read)
@@ -495,16 +495,16 @@ namespace Venus_RT.Devices
                 else if (rawMessage[7] == _readInvalid)
                 {
                     int DataValue = BitConverter.ToInt32(new byte[] { rawMessage[8], 0x00, 0x00, 0x00 }, 0);
-                    //LOG.Error($"{Module} [{Display} Read] invalid request, Command Number is {_currentCommandNumber.ToString()}, Exception Code is 0x{DataValue.ToString("X")}");
+                    LOG.Write(eEvent.ERR_RF, Module, $"{Module} [{Display} Read] invalid request, Command Number is {_currentCommandNumber.ToString()}, Exception Code is 0x{DataValue.ToString("X")}");
                 }
                 else if (rawMessage[7] == _writeInvalid)
                 {
                     int DataValue = BitConverter.ToInt32(new byte[] { rawMessage[8], 0x00, 0x00, 0x00 }, 0);
-                    //LOG.Error($"{Module} [{Display} Write] invalid request, Command Number is {_currentCommandNumber.ToString()}, Exception Code is 0x{DataValue.ToString("X")}");
+                    LOG.Write(eEvent.ERR_RF, Module, $"{Module} [{Display} Write] invalid request, Command Number is {_currentCommandNumber.ToString()}, Exception Code is 0x{DataValue.ToString("X")}");
                 }
                 else
                 {
-                    //LOG.Error($"RF invalid function code");
+                    LOG.Write(eEvent.ERR_RF, Module, $"RF invalid function code");
                 }
             }
             //catch (ExcuteFailedException e)
@@ -533,7 +533,7 @@ namespace Venus_RT.Devices
                     switch (value)
                     {
                         case 0:
-                            //LOG.Info($"{Module} [{Display} Read] Device is not ready");
+                            LOG.Write(eEvent.ERR_RF, Module, $"{Module} [{Display} Read] Device is not ready");
                             break;
                         case 1:
                             //LOG.Info($"{Module} [{Display} Read] Device is ready, RF is off");

+ 1 - 1
Venus/Venus_RT/Devices/ESC5HighVoltage.cs

@@ -84,7 +84,7 @@ namespace Venus_RT.Devices
             {Operation.SetUpRampTime,               "P+{0:D}\r" },
         };
 
-        private readonly int _readInterval = 500;
+        private readonly int _readInterval = 1000;
         private readonly int _readTimeout = 2000;
         private readonly AsyncSerialPort _serial;
         private Stopwatch _queryWatch = new Stopwatch();

+ 9 - 8
Venus/Venus_RT/Devices/EdwardsPump.cs

@@ -230,7 +230,7 @@ namespace Venus_RT.Devices
             if (!_serial.Open())
             {
                 StatusDry = EdwardsPumpState.Disconnected;
-                EV.PostAlarmLog(Module, "Edwards Pump串口无法打开");
+                LOG.Write(eEvent.ERR_DRY_PUMP, Module, "Edwards Pump串口无法打开");
                 return false;
             }
 
@@ -255,13 +255,14 @@ namespace Venus_RT.Devices
         private void OnErrorOccurred(string obj)
         {
             StatusDry = EdwardsPumpState.ERROR;
-            //LOG.Error($"[{Module}] edwards pump error: [{obj}]");
+            LOG.Write(eEvent.WARN_DEVICE_INFO, Module, $"[{Module}] edwards pump error: [{obj}]");
         }
 
         private void OnPortDataChanged(string obj)
         {
             if (string.IsNullOrEmpty(obj))
-                //LOG.Error($"[{Module}] edwards pump message IsNullOrEmpty");
+                LOG.Write(eEvent.WARN_DEVICE_INFO, Module, "edwards pump message IsNullOrEmpty");
+
             try
             {
                 _timerReceiveStatus.Stop();
@@ -290,7 +291,7 @@ namespace Venus_RT.Devices
                             if (_trigPumpOn.Q && _timerPumpOn.IsTimeout())
                             {
                                 _trigPumpOn.RST = true;
-                                EV.PostMessage(Module, EventEnum.DefaultWarning, "Edwards Pump 无法打开");
+                                LOG.Write(eEvent.WARN_DEVICE_INFO, Module, "Edwards Pump 无法打开");
                             }
                             if (_trigPumpOff.Q)
                             {
@@ -304,7 +305,7 @@ namespace Venus_RT.Devices
                             if (_trigPumpOff.Q && _timerPumpOff.IsTimeout())
                             {
                                 _trigPumpOff.RST = true;
-                                EV.PostMessage(Module, EventEnum.DefaultWarning, "Edwards Pump 无法关闭");
+                                LOG.Write(eEvent.WARN_DEVICE_INFO, Module, "Edwards Pump 无法关闭");
                             }
                             if (_trigPumpOn.Q)
                             {
@@ -316,7 +317,7 @@ namespace Venus_RT.Devices
 
                         break;
                     default:
-                        //EV.PostInfoLog(this.Module, $"Edwards Pump {SendData} {QueryCmdReply(cmd)}");
+                        LOG.Write(eEvent.EV_DEVICE_INFO, Module, $"Edwards Pump {SendData} {QueryCmdReply(cmd)}");
                         break;
                 }
             }
@@ -431,13 +432,13 @@ namespace Venus_RT.Devices
             {
                 _trigPumpOn.CLK = true;
                 _timerPumpOn.Start(CHK_PUMP_REC_INTERVAL);
-                //LOG.Info($"[{Module}] Switch on Edwards Pump");
+                LOG.Write(eEvent.EV_DEVICE_INFO, Module, $"[{Module}] Switch on Edwards Pump");
             }
             else if (SendData == "!P2")
             {
                 _trigPumpOff.CLK = true;
                 _timerPumpOff.Start(CHK_PUMP_REC_INTERVAL);
-                //LOG.Info($"[{Module}] Switch off Edwards Pump");
+                LOG.Write(eEvent.EV_DEVICE_INFO, Module, $"[{Module}] Switch off Edwards Pump");
             }
             return _serial.Write(str + "\r");
         }

+ 11 - 0
Venus/Venus_RT/Devices/JetPM.cs

@@ -682,6 +682,17 @@ namespace Venus_RT.Devices
         {
             reason = string.Empty;
 
+            if(open)
+            {
+                double maxPressureDifference = SC.GetValue<double>("System.PMLLMaxPressureDifference");
+                if(Math.Abs(LoadlockPressure - ChamberPressure) > maxPressureDifference)
+                {
+                    reason = $"{Module} and Loadlock pressure difference exceeds the max limit";
+                    LOG.Write(eEvent.ERR_DEVICE_INFO, Module, reason);
+                    return;
+                }
+            }
+
             _slitDoor.SetCylinder(open, out reason);
         }
 

+ 1 - 1
Venus/Venus_RT/Devices/PendulumValve.cs

@@ -155,7 +155,7 @@ namespace Venus_RT.Devices
         public bool IsOpen { get; private set; }
 
         private readonly string EOF = "\r\n";
-        private readonly int _readInterval = 500;
+        private readonly int _readInterval = 1000;
         private int _queryFlag = 0;
         private readonly AsyncSerialPort _serial;
         private Stopwatch _queryWatch = new Stopwatch();