IoTMPressureCtl.cs 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. using System;
  2. using System.Xml;
  3. using Aitex.Core.Common.DeviceData;
  4. using Aitex.Core.RT.Device;
  5. using Aitex.Core.RT.Event;
  6. using Aitex.Core.RT.IOCore;
  7. using Aitex.Core.RT.OperationCenter;
  8. using Aitex.Core.RT.SCCore;
  9. using Aitex.Core.RT.Tolerance;
  10. using Aitex.Core.Util;
  11. using Venus_RT.Devices.IODevices;
  12. using Aitex.Core.RT.Log;
  13. using Aitex.Core.RT.DataCenter;
  14. namespace Venus_RT.Devices
  15. {
  16. class IoTMPressureCtrl : BaseDevice, IDevice
  17. {
  18. public readonly IoPressureMeter TMPressureGauge;
  19. public readonly IoPressureMeter LLAPressureGauge;
  20. public readonly IoPressureMeter LLBPressureGauge;
  21. public readonly IoPressureMeter MFForelineGauge;
  22. public readonly IoPressureMeter LLForelineGauge;
  23. private readonly ToleranceChecker _tolerance = new ToleranceChecker();
  24. private readonly R_TRIG _trigTMPressureGauge = new R_TRIG();
  25. private readonly R_TRIG _trigLLAPressureGauge = new R_TRIG();
  26. private readonly R_TRIG _trigLLBPressureGauge = new R_TRIG();
  27. private readonly R_TRIG _trigMFForelineGauge = new R_TRIG();
  28. private readonly R_TRIG _trigLLForelineGauge = new R_TRIG();
  29. private readonly AOAccessor _aoMFPressureSP;
  30. private readonly AOAccessor _aoLLAPressureSP;
  31. private readonly AOAccessor _aoLLBPressureSP;
  32. // Properties
  33. //
  34. public double TargetPressure { get; set; }
  35. // Constructor
  36. //
  37. public IoTMPressureCtrl(string module, XmlElement node, string ioModule = "")
  38. {
  39. base.Module = module;
  40. base.Name = node.GetAttribute("id");
  41. base.Display = node.GetAttribute("display");
  42. base.DeviceID = node.GetAttribute("schematicId");
  43. TMPressureGauge = ParseDeviceNode<IoPressureMeter>(Module, "MFPressureMeter", node);
  44. LLAPressureGauge = ParseDeviceNode<IoPressureMeter>(Module, "LLAPressureMeter", node);
  45. LLBPressureGauge = ParseDeviceNode<IoPressureMeter>(Module, "LLBPressureMeter", node);
  46. MFForelineGauge = ParseDeviceNode<IoPressureMeter>(Module, "MFForelineMeter", node);
  47. LLForelineGauge = ParseDeviceNode<IoPressureMeter>(Module, "LLForelineMeter", node);
  48. _aoMFPressureSP = ParseAoNode("aoMFPressure", node, ioModule);
  49. _aoLLAPressureSP = ParseAoNode("aoLLAPressure", node, ioModule);
  50. _aoLLBPressureSP = ParseAoNode("aoLLBPressure", node, ioModule);
  51. }
  52. public bool Initialize()
  53. {
  54. DATA.Subscribe($"{Module}.{Name}.TMChamberSetPoint", () => _GetRealFloat(_aoMFPressureSP));
  55. DATA.Subscribe($"{Module}.{Name}.LLAChamberSetPoint", () => _GetRealFloat(_aoLLAPressureSP));
  56. DATA.Subscribe($"{Module}.{Name}.LLBChamberSetPoint", () => _GetRealFloat(_aoLLBPressureSP));
  57. return true;
  58. }
  59. public void SetTMPressure(float pressure)
  60. {
  61. _SetRealFloat(_aoMFPressureSP, pressure);
  62. }
  63. public void SetLLAPressure(float pressure)
  64. {
  65. _SetRealFloat(_aoLLAPressureSP, pressure);
  66. }
  67. public void SetLLBPressure(float pressure)
  68. {
  69. _SetRealFloat(_aoLLBPressureSP, pressure);
  70. }
  71. public void Terminate()
  72. {
  73. }
  74. public void Monitor()
  75. {
  76. _trigTMPressureGauge.CLK = TMPressureGauge.GaugeAlarm;
  77. if (_trigTMPressureGauge.Q) LOG.Write(eEvent.ERR_DEVICE_INFO, Module, "MF pressure gauge Alarm");
  78. _trigLLAPressureGauge.CLK = LLAPressureGauge.GaugeAlarm;
  79. if (_trigLLAPressureGauge.Q) LOG.Write(eEvent.ERR_DEVICE_INFO, Module, "Chamber pressure gauge Alarm");
  80. _trigLLBPressureGauge.CLK = LLBPressureGauge.GaugeAlarm;
  81. if (_trigLLBPressureGauge.Q) LOG.Write(eEvent.ERR_DEVICE_INFO, Module, "Foreline pressure gauge Alarm");
  82. _trigMFForelineGauge.CLK = MFForelineGauge.GaugeAlarm;
  83. if (_trigMFForelineGauge.Q) LOG.Write(eEvent.ERR_DEVICE_INFO, Module, "Process High Gauge Alarm");
  84. _trigLLForelineGauge.CLK = LLForelineGauge.GaugeAlarm;
  85. if (_trigLLForelineGauge.Q) LOG.Write(eEvent.ERR_DEVICE_INFO, Module, "Process Low Gauge Alarm");
  86. }
  87. public void Reset()
  88. {
  89. _trigTMPressureGauge.RST = true;
  90. _trigLLAPressureGauge.RST = true;
  91. _trigLLBPressureGauge.RST = true;
  92. _trigMFForelineGauge.RST = true;
  93. _trigLLForelineGauge.RST = true;
  94. }
  95. }
  96. }