Browse Source

代码合并

lixiang 1 year ago
parent
commit
6910d4754e

BIN
Venus/Venus_RT/Config/PM/Kepler2200A/Kepler2200ADeviceModel.xml


+ 34 - 27
Venus/Venus_RT/Devices/PendulumValve.cs

@@ -175,7 +175,7 @@ namespace Venus_RT.Devices
         private string _lastAlarmString = string.Empty;
         private Operation[] _querys = new Operation[] { Operation.GetPressure, Operation.GetPosition, Operation.GetDeviceStatus, Operation.GetPressureSP };
         BlockingCollection<string> blockingCollection = new BlockingCollection<string>();
-        public  AITPendulumValveData DeviceData
+        public AITPendulumValveData DeviceData
         {
             get
             {
@@ -184,7 +184,7 @@ namespace Venus_RT.Devices
                     DeviceName = Name,
                     Module = Module,
                     Pressure = Pressure,
-                    IsOpen = IsOpen || Position>0,
+                    IsOpen = IsOpen || Position > 0,
                     Position = IsOpen ? Position : 0,
 
                 };
@@ -194,14 +194,14 @@ namespace Venus_RT.Devices
 
         public PendulumValve(ModuleName mod)
         {
-            Name            = VenusDevice.PendulumValve.ToString();
-            Module          = mod.ToString();
-            var _PortNum    = SC.GetStringValue($"{mod}.PendulumValve.Port");
-            _serial         = new AsyncSerialPort(_PortNum, 9600, 8, System.IO.Ports.Parity.None, System.IO.Ports.StopBits.One, EOF);
+            Name = VenusDevice.PendulumValve.ToString();
+            Module = mod.ToString();
+            var _PortNum = SC.GetStringValue($"{mod}.PendulumValve.Port");
+            _serial = new AsyncSerialPort(_PortNum, 9600, 8, System.IO.Ports.Parity.None, System.IO.Ports.StopBits.One, EOF);
             _pressure_ful_range = SC.GetValue<int>($"{mod}.PendulumValve.PressureFullRange");
             _foreLinePressureLimit = SC.GetValue<int>($"{mod}.PendulumValve.ForelinePressureLimit");
-            _chamberPressureLimit  = SC.GetValue<int>($"{mod}.PendulumValve.ChamberPressureLimit");
-            _turboPumpSpeedLimit   = SC.GetValue<int>($"{mod}.PendulumValve.TurboPumpSpeedLimit");
+            _chamberPressureLimit = SC.GetValue<int>($"{mod}.PendulumValve.ChamberPressureLimit");
+            _turboPumpSpeedLimit = SC.GetValue<int>($"{mod}.PendulumValve.TurboPumpSpeedLimit");
 
 
             IsOpen = false;
@@ -235,7 +235,7 @@ namespace Venus_RT.Devices
 
         public void Monitor()
         {
-            if(_queryWatch.ElapsedMilliseconds > _readInterval)
+            if (_queryWatch.ElapsedMilliseconds > _readInterval)
             {
                 SendCommand(_querys[_queryFlag++ % 4]);
                 _queryWatch.Restart();
@@ -263,18 +263,18 @@ namespace Venus_RT.Devices
             {
                 _noRepeatAlarm("VAT Pendulum Valve receive empty message");
                 return;
-            }    
+            }
 
             try
             {
                 var data = obj.TrimEnd().Split(':');
-                switch(data[0])
+                switch (data[0])
                 {
                     case "P":
                         {
                             int pressure;
                             if (int.TryParse(data[1], out pressure))
-                                Pressure = pressure  * _pressure_ful_range  / 1000000;
+                                Pressure = pressure * _pressure_ful_range / 1000000;
                         }
                         break;
                     case "A":
@@ -310,7 +310,7 @@ namespace Venus_RT.Devices
                             break;
                         }
                 }
-                
+
             }
             catch (Exception ex)
             {
@@ -320,7 +320,7 @@ namespace Venus_RT.Devices
 
         private bool SendCommand(Operation op)
         {
-            if(_noneParaCommandOp.ContainsKey(op))
+            if (_noneParaCommandOp.ContainsKey(op))
             {
                 blockingCollection.Add(_noneParaCommandOp[op] + EOF);
                 return true;
@@ -333,7 +333,7 @@ namespace Venus_RT.Devices
         }
         private bool SendCommand(Operation op, int data)
         {
-            if(_singleParaCommandOp.ContainsKey(op))
+            if (_singleParaCommandOp.ContainsKey(op))
             {
                 var cmd = string.Format(_singleParaCommandOp[op], data) + EOF;
                 return _sendCmd(cmd);
@@ -367,21 +367,21 @@ namespace Venus_RT.Devices
             var cmdPrix = data.Substring(0, 4);
 
             Operation oper = Operation.Invalid;
-            foreach( var item in _noneParaCommandOp)
+            foreach (var item in _noneParaCommandOp)
             {
-                if(item.Value == cmdPrix)
+                if (item.Value == cmdPrix)
                 {
                     oper = item.Key;
                     break;
                 }
             }
 
-            if( oper == Operation.Invalid)
+            if (oper == Operation.Invalid)
             {
-                return false; 
+                return false;
             }
 
-            switch(oper)
+            switch (oper)
             {
                 case Operation.GetDeviceStatus:
                     {
@@ -424,7 +424,7 @@ namespace Venus_RT.Devices
 
         public bool SetPosition(int postion)
         {
-            if(_CheckStatus())
+            if (_CheckStatus())
             {
                 return SendCommand(Operation.SetPosition, postion * _position_unit);
             }
@@ -434,7 +434,7 @@ namespace Venus_RT.Devices
 
         public bool SetPressure(int pressure)
         {
-            if(_CheckStatus())
+            if (_CheckStatus())
             {
                 //IsOpen = true;
                 return SendCommand(Operation.SetPressure, pressure * 1000000 / _pressure_ful_range);
@@ -450,10 +450,17 @@ namespace Venus_RT.Devices
 
         public bool TurnValve(bool on)
         {
-            if(_CheckStatus(on))
+            if (on == false)
             {
                 return SendCommand(on ? Operation.OpenValve : Operation.CloseValve);
             }
+            else
+            {
+                if (_CheckStatus(on))
+                {
+                    return SendCommand(on ? Operation.OpenValve : Operation.CloseValve);
+                }
+            }
 
             return false;
         }
@@ -474,14 +481,14 @@ namespace Venus_RT.Devices
             }
 
             if (_chamber.ForelinePressure > _foreLinePressureLimit)
-            {              
-                LOG.Write(eEvent.ERR_DEVICE_INFO, Module, $"Foreline Pressure:{_chamber.ForelinePressure} is higher than {_foreLinePressureLimit}mtorr, can not turn on pendulum valve.");               
+            {
+                LOG.Write(eEvent.ERR_DEVICE_INFO, Module, $"Foreline Pressure:{_chamber.ForelinePressure} is higher than {_foreLinePressureLimit}mtorr, can not turn on pendulum valve.");
                 return false;
             }
 
-            if(_chamber.ChamberPressure > _chamberPressureLimit && _chamber.TurboPumpSpeed > _turboPumpSpeedLimit)
+            if (_chamber.ChamberPressure > _chamberPressureLimit && _chamber.TurboPumpSpeed > _turboPumpSpeedLimit)
             {
-                LOG.Write(eEvent.ERR_DEVICE_INFO, Module, $"Chamber Pressure:{_chamber.ChamberPressure} is higher than {_chamberPressureLimit}mtorr and Chamber.TurboPumpSpeed is higher than {_turboPumpSpeedLimit}, can not turn on pendulum valve.");              
+                LOG.Write(eEvent.ERR_DEVICE_INFO, Module, $"Chamber Pressure:{_chamber.ChamberPressure} is higher than {_chamberPressureLimit}mtorr and Chamber.TurboPumpSpeed is higher than {_turboPumpSpeedLimit}, can not turn on pendulum valve.");
                 return false;
             }