ChillerBase.cs 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. using Aitex.Core.Common.DeviceData;
  2. using Aitex.Core.RT.DataCenter;
  3. using Aitex.Core.RT.Device;
  4. using Aitex.Core.RT.OperationCenter;
  5. using MECF.Framework.Common.CommonData.DeviceData;
  6. using System;
  7. using System.Collections.Generic;
  8. using System.Linq;
  9. using System.Text;
  10. using System.Threading.Tasks;
  11. using System.Xml;
  12. namespace MECF.Framework.Common.Device.Bases
  13. {
  14. [Serializable]
  15. public abstract class ChillerBase : BaseDevice, IDevice
  16. {
  17. public virtual bool IsConnected => true;
  18. public virtual bool IsCH1Alarm { get; set; }
  19. public virtual bool IsCH2Alarm { get; set; }
  20. public virtual bool IsCH1Warning { get; set; }
  21. public virtual bool IsCH2Warning { get; set; }
  22. public virtual bool IsCH1On { get; set; }
  23. public virtual bool IsCH2On { get; set; }
  24. public virtual float CH1TemperatureSetpoint { get; set; }
  25. public virtual float CH1TemperatureFeedback { get; set; }
  26. public virtual float CH2TemperatureSetpoint { get; set; }
  27. public virtual float CH2TemperatureFeedback { get; set; }
  28. public virtual float CH1WaterFlow { get; set; }
  29. public virtual float CH2WaterFlow { get; set; }
  30. public virtual float TemperatureHighLimit { get; set; }
  31. public virtual float TemperatureLowLimit { get; set; }
  32. public virtual bool IsCH1Remote { get; set; }
  33. public virtual bool IsCH2Remote { get; set; }
  34. public virtual AITChillerData1 DeviceData { get; set; }
  35. protected ChillerBase() : base()
  36. {
  37. }
  38. protected ChillerBase(string module, XmlElement node, string ioModule = "")
  39. {
  40. base.Module = string.IsNullOrEmpty(node.GetAttribute("module")) ? module : node.GetAttribute("module");
  41. base.Name = node.GetAttribute("id");
  42. }
  43. public virtual bool Initialize()
  44. {
  45. DATA.Subscribe($"{Module}.{Name}.DeviceData", () => DeviceData);
  46. DATA.Subscribe($"{Module}.{Name}.IsCH1On", () => IsCH1On);
  47. DATA.Subscribe($"{Module}.{Name}.IsCH2On", () => IsCH2On);
  48. DATA.Subscribe($"{Module}.{Name}.IsCH1Alarm", () => IsCH1Alarm);
  49. DATA.Subscribe($"{Module}.{Name}.IsCH2Alarm", () => IsCH2Alarm);
  50. DATA.Subscribe($"{Module}.{Name}.CH1TemperatureSetpoint", () => CH1TemperatureSetpoint);
  51. DATA.Subscribe($"{Module}.{Name}.CH2TemperatureSetpoint", () => CH2TemperatureSetpoint);
  52. DATA.Subscribe($"{Module}.{Name}.CH1TemperatureFeedback", () => CH1TemperatureFeedback);
  53. DATA.Subscribe($"{Module}.{Name}.CH2TemperatureFeedback", () => CH2TemperatureFeedback);
  54. DATA.Subscribe($"{Module}.{Name}.CH1WaterFlow", () => CH1WaterFlow);
  55. DATA.Subscribe($"{Module}.{Name}.CH2WaterFlow", () => CH2WaterFlow);
  56. OP.Subscribe($"{Module}.{Name}.SetChillerCH1On", (function, args) =>
  57. {
  58. SetChillerCH1OnOff(Convert.ToBoolean(args[0]));
  59. return true;
  60. });
  61. OP.Subscribe($"{Module}.{Name}.SetChillerCH2On", (function, args) =>
  62. {
  63. SetChillerCH2OnOff(Convert.ToBoolean(args[0]));
  64. return true;
  65. });
  66. OP.Subscribe($"{Module}.{Name}.SetChillerCH1Temperature", (function, args) =>
  67. {
  68. SetChillerCH1Temperature(Convert.ToSingle(args[0]));
  69. return true;
  70. });
  71. OP.Subscribe($"{Module}.{Name}.SetChillerCH2Temperature", (function, args) =>
  72. {
  73. SetChillerCH2Temperature(Convert.ToSingle(args[0]));
  74. return true;
  75. });
  76. return true;
  77. }
  78. public virtual void SetChillerCH1OnOff(bool isOn)
  79. {
  80. }
  81. public virtual void SetChillerCH2OnOff(bool isOn)
  82. {
  83. }
  84. public virtual void SetChillerCH1Temperature(float temperature)
  85. {
  86. }
  87. public virtual void SetChillerCH2Temperature(float temperature)
  88. {
  89. }
  90. public virtual void Terminate()
  91. {
  92. }
  93. public virtual void Monitor()
  94. {
  95. }
  96. public virtual void Reset()
  97. {
  98. }
  99. }
  100. }