| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262 | 
							- using System;
 
- using System.Xml;
 
- using Aitex.Core.Common.DeviceData;
 
- using Aitex.Core.RT.Device;
 
- using Aitex.Core.RT.Event;
 
- using Aitex.Core.RT.IOCore;
 
- using Aitex.Core.RT.OperationCenter;
 
- using Aitex.Core.RT.SCCore;
 
- using Aitex.Core.RT.Tolerance;
 
- using Aitex.Core.Util;
 
- using Venus_RT.Devices.IODevices;
 
- using Aitex.Core.RT.Log;
 
- using Venus_Core;
 
- using Venus_RT.Modules;
 
- namespace Venus_RT.Devices
 
- {
 
-     public class IoPressureControl : BaseDevice, IDevice
 
-     {
 
-         private bool _enableTolerance;
 
-         public bool EnableTolerance
 
-         {
 
-             get
 
-             {
 
-                 return _enableTolerance;
 
-             }
 
-             set
 
-             {
 
-                 if (_enableTolerance != value)
 
-                 {
 
-                     LOG.Write(eEvent.EV_DEVICE_INFO, Module, value ? "Start monitor pressure stability" : "Stop monitor pressure stability");
 
-                     if (value)
 
-                     {
 
-                         _tolerance.Reset(_scAlarmTime.DoubleValue);
 
-                     }
 
-                 }
 
-                 _enableTolerance = value;
 
-             }
 
-         }
 
-         public bool IsIndependentControl
 
-         {
 
-             get
 
-             {
 
-                 if (_scIsIndependentControl != null)
 
-                     return _scIsIndependentControl.BoolValue;
 
-                 return false;
 
-             }
 
-         }
 
-         public bool IsTvInstalled
 
-         {
 
-             get
 
-             {
 
-                 if (_scTvInstalled != null)
 
-                     return _scTvInstalled.BoolValue;
 
-                 return false;
 
-             }
 
-         }
 
-         public bool IsBoostPumpInstalled
 
-         {
 
-             get
 
-             {
 
-                 if (_scIsBoostPumpInstalled != null)
 
-                     return _scIsBoostPumpInstalled.BoolValue;
 
-                 return false;
 
-             }
 
-         }
 
-         public bool EnableBoostControl
 
-         {
 
-             get
 
-             {
 
-                 return _diLogicProcessGasFlowing == null || _diLogicProcessGasFlowing.Value;
 
-             }
 
-         }
 
-         //public readonly IoThrottleValve ThrottleValve;
 
-         public readonly IoPressureMeter PressureGauge;
 
-         public readonly IoPressureMeter ProcessGauge;
 
-         public readonly IoPressureMeter ForelineGauge;
 
-         public readonly IoPressureMeter LoadLockGauge;
 
-         public readonly IoPressureMeter ESCHeGauge;
 
-         public readonly IoPressureMeter ProcessHigh;
 
-         public readonly IoPressureMeter ProcessLow;
 
-         //public readonly IoBoostPump _boost;
 
-         //public readonly IoPump DryPump;
 
-         private readonly ToleranceChecker _tolerance = new ToleranceChecker();
 
-         private readonly SCConfigItem _scAlarmRange;
 
-         private readonly SCConfigItem _scAlarmTime;
 
-         private readonly SCConfigItem _scIsIndependentControl;
 
-         private readonly SCConfigItem _scIsBoostPumpInstalled;
 
-         private readonly SCConfigItem _scTvInstalled;
 
-         private readonly DIAccessor _diLogicProcessGasFlowing;
 
-         private readonly R_TRIG _trigPressureGauge = new R_TRIG();
 
-         private readonly R_TRIG _trigProcessGauge = new R_TRIG();
 
-         private readonly R_TRIG _trigForelineGauge = new R_TRIG();
 
-         private readonly R_TRIG _trigProcessHighGauge = new R_TRIG();
 
-         private readonly R_TRIG _trigProcessLowGauge = new R_TRIG();
 
-         private readonly R_TRIG _trigESCHePressureGauge = new R_TRIG();
 
-         private readonly R_TRIG _trigLoadLockGaugePressureGauge = new R_TRIG();
 
-         private readonly AOAccessor _aoMFPressureSP;
 
-         // Properties
 
-         //
 
-         public double TargetPressure { get; set; }
 
-         
 
-         private string PressureOutOfTolerance = "PressureOutOfTolerance";
 
-         // Constructor
 
-         //
 
-         public IoPressureControl(string module, XmlElement node, string ioModule = "")
 
-         {
 
-             base.Module = module;
 
-             base.Name = node.GetAttribute("id");
 
-             base.Display = node.GetAttribute("display");
 
-             base.DeviceID = node.GetAttribute("schematicId");
 
-             _diLogicProcessGasFlowing   = ParseDiNode("diLogicProcessGasFlowing", node, ioModule);
 
-             _scAlarmRange               = SC.GetConfigItem($"{Module}.GasFlowPressureAlarmRange");
 
-             _scAlarmTime                = SC.GetConfigItem($"{Module}.GasFlowPressureAlarmTime");
 
-             _scIsIndependentControl     = SC.GetConfigItem($"{Module}.IsIndependentControl");
 
-             _scIsBoostPumpInstalled     = SC.GetConfigItem($"{Module}.EnableBoosterPump");
 
-             _scTvInstalled              = SC.GetConfigItem($"{Module}.EnableThrottleValve");
 
-             //_enableTolerance = true;
 
-             PressureGauge               = ParseDeviceNode<IoPressureMeter>(Module, "pressureMeter", node);
 
-             ProcessGauge                = ParseDeviceNode<IoPressureMeter>(Module, "processMeter", node);
 
-             ForelineGauge               = ParseDeviceNode<IoPressureMeter>(Module, "forelineMeter", node);
 
-             LoadLockGauge               = ParseDeviceNode<IoPressureMeter>(Module, "loadlockMeter", node);
 
-             ESCHeGauge                  = ParseDeviceNode<IoPressureMeter>(Module, "escHeGauge", node);
 
-             ProcessHigh                 = ParseDeviceNode<IoPressureMeter>(Module, "processPressureHigh", node);
 
-             ProcessLow                  = ParseDeviceNode<IoPressureMeter>(Module, "processPressureLow", node);
 
-             _aoMFPressureSP             = ParseAoNode("tmPressureSetPoint", node, ioModule);
 
-             //DryPump                     = ParseDeviceNode<IoPump>(Module, "drypump", node);
 
-         }
 
-         public bool Initialize()
 
-         {
 
-             //DEVICE.Register($"{Module}.{Name}.{AITPressureControlOperation.SetBoostPressure}", _setBoostPressure);
 
-             DEVICE.Register($"{Module}.{Name}.{AITPressureControlOperation.SetChamberPressure}", _setChamberPressure);
 
-             OP.Subscribe($"{Module}.{Name}.{AITPressureControlOperation.SetChamberPressure}", (out string reason, int time, object[] param) =>
 
-             {
 
-                 _setChamberPressure(out reason, 0, param);
 
-                 return true;
 
-             });
 
-             EV.Subscribe(new EventItem("Event", PressureOutOfTolerance, "Pressure Out Of Tolerance", EventLevel.Alarm, EventType.HostNotification));
 
-             return true;
 
-         }
 
-         //public void StartPump(bool on)
 
-         //{
 
-         //    this.DryPump?.Start(on);
 
-         //}
 
-         private bool? _setChamberPressure(out string reason, int time, object[] param)
 
-         {
 
-             double setpoint = Convert.ToDouble((string)param[0]);
 
-             TargetPressure = setpoint;
 
-             reason = $"Chamber pressure set to {setpoint} mTorr";
 
-             return true;
 
-         }
 
-         public void Terminate()
 
-         {
 
-         }
 
-         public void Monitor()
 
-         {
 
-             CheckTolerance();
 
-             //JetChamber jetChamber = (JetChamber)(SC.GetValue<int>("System.ChamberSelect"));//Venus or Kepler
 
-             //if (RtInstance.CurrentChamber == JetChamber.Venus)
 
-             //{
 
-             //    _trigPressureGauge.CLK = PressureGauge.GaugeAlarm;
 
-             //    if (_trigPressureGauge.Q) LOG.Write(eEvent.ERR_DEVICE_INFO, Module, "Chamber pressure gauge Alarm");
 
-             //    _trigLoadLockGaugePressureGauge.CLK = LoadLockGauge.GaugeAlarm;
 
-             //    if (_trigLoadLockGaugePressureGauge.Q) LOG.Write(eEvent.ERR_DEVICE_INFO, Module, "LoadLock Pressure Gauge Alarm");
 
-             //}
 
-             _trigProcessGauge.CLK = ProcessGauge.GaugeAlarm;
 
-             if (_trigProcessGauge.Q) LOG.Write(eEvent.ERR_DEVICE_INFO, Module, "Process pressure gauge Alarm");
 
-            
 
-             _trigForelineGauge.CLK = ForelineGauge.GaugeAlarm;
 
-             if (_trigForelineGauge.Q) LOG.Write(eEvent.ERR_DEVICE_INFO, Module, "Foreline pressure gauge Alarm");
 
-             _trigProcessHighGauge.CLK = ProcessHigh.GaugeAlarm;
 
-             if (_trigProcessHighGauge.Q) LOG.Write(eEvent.ERR_DEVICE_INFO, Module, "Process High Gauge Alarm");
 
-             _trigProcessLowGauge.CLK = ProcessLow.GaugeAlarm;
 
-             if (_trigProcessLowGauge.Q) LOG.Write(eEvent.ERR_DEVICE_INFO, Module, "Process Low Gauge Alarm");
 
-             if (ESCHeGauge != null)
 
-             {
 
-                 _trigESCHePressureGauge.CLK = ESCHeGauge.GaugeAlarm;
 
-                 if (_trigESCHePressureGauge.Q) LOG.Write(eEvent.ERR_DEVICE_INFO, Module, "ESC He Pressure Gauge Alarm");
 
-             }
 
-             
 
-           
 
-             //MFPressureWrite();
 
-         }
 
-         public void CheckTolerance()
 
-         {
 
-             if (!EnableTolerance)
 
-                 return;
 
-             //if (ThrottleValve != null && IsTvInstalled && ThrottleValve.PressureMode == PressureCtrlMode.TVPositionCtrl)
 
-             //    return;
 
-             _tolerance.Monitor(PressureGauge.Value,
 
-                 TargetPressure - Math.Abs(_scAlarmRange.DoubleValue),
 
-                 TargetPressure + Math.Abs(_scAlarmRange.DoubleValue), _scAlarmTime.DoubleValue);
 
-             if (_tolerance.Trig)
 
-             {
 
-                 EV.Notify(PressureOutOfTolerance);
 
-                 LOG.Write(eEvent.ERR_DEVICE_INFO, Module, $"Gas Flow Pressure Alarm Out of range in {_scAlarmTime.Value:0} seconds");
 
-             }
 
-         }
 
-         public void Reset()
 
-         {
 
-             _trigProcessGauge.RST = true;
 
-             _trigPressureGauge.RST = true;
 
-             _trigForelineGauge.RST = true;
 
-             if (_scAlarmTime != null)
 
-             {
 
-                 _tolerance.Reset(_scAlarmTime.DoubleValue);
 
-             }
 
-         }
 
-         private void MFPressureWrite()
 
-         {
 
-             if (_aoMFPressureSP == null)
 
-                 return;
 
-             _SetRealFloat(_aoMFPressureSP, 100);
 
-         }
 
-     }
 
- }
 
 
  |