ChillerBase.cs 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  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. public abstract class ChillerBase : BaseDevice, IDevice
  15. {
  16. public virtual bool IsConnected => true;
  17. public virtual bool IsCH1Alarm { get; set; }
  18. public virtual bool IsCH2Alarm { get; set; }
  19. public virtual bool IsCH1Warning { get; set; }
  20. public virtual bool IsCH2Warning { get; set; }
  21. public virtual bool IsCH1On { get; set; }
  22. public virtual bool IsCH2On { get; set; }
  23. public virtual float[] TemperatureSetpoint { get; set; }
  24. public virtual float[] TemperatureFeedback { get; set; }
  25. public virtual float[] TemperaturePValue { get; set; }
  26. public virtual float[] TemperatureIValue { get; set; }
  27. public virtual float[] TemperatureDValue { get; set; }
  28. public virtual float[] TemperatureOffsetValue { get; set; }
  29. public virtual float CH1WaterFlow { get; set; }
  30. public virtual float CH2WaterFlow { get; set; }
  31. public virtual float Frequency { get; set; }
  32. public virtual float TemperatureHighLimit { get; set; }
  33. public virtual float TemperatureLowLimit { 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}.TemperatureSetpoint", () => TemperatureSetpoint);
  51. DATA.Subscribe($"{Module}.{Name}.TemperatureFeedback", () => TemperatureFeedback);
  52. DATA.Subscribe($"{Module}.{Name}.TemperaturePValue", () => TemperaturePValue);
  53. DATA.Subscribe($"{Module}.{Name}.TemperatureIValue", () => TemperatureIValue);
  54. DATA.Subscribe($"{Module}.{Name}.TemperatureDValue", () => TemperatureDValue);
  55. DATA.Subscribe($"{Module}.{Name}.TemperatureOffsetValue", () => TemperatureOffsetValue);
  56. DATA.Subscribe($"{Module}.{Name}.CH1WaterFlow", () => CH1WaterFlow);
  57. DATA.Subscribe($"{Module}.{Name}.CH2WaterFlow", () => CH2WaterFlow);
  58. OP.Subscribe($"{Module}.{Name}.SetChillerCH1On", (function, args) =>
  59. {
  60. SetChillerCH1OnOff(Convert.ToBoolean(args[0]));
  61. return true;
  62. });
  63. OP.Subscribe($"{Module}.{Name}.SetChillerCH2On", (function, args) =>
  64. {
  65. SetChillerCH2OnOff(Convert.ToBoolean(args[0]));
  66. return true;
  67. });
  68. OP.Subscribe($"{Module}.{Name}.SetChillerCH1Temperature", (function, args) =>
  69. {
  70. SetChillerCH1Temperature(Convert.ToSingle(args[0]));
  71. return true;
  72. });
  73. OP.Subscribe($"{Module}.{Name}.SetChillerCH2Temperature", (function, args) =>
  74. {
  75. SetChillerCH2Temperature(Convert.ToSingle(args[0]));
  76. return true;
  77. });
  78. return true;
  79. }
  80. public virtual void SetChillerCH1OnOff(bool isOn)
  81. {
  82. }
  83. public virtual void SetChillerCH2OnOff(bool isOn)
  84. {
  85. }
  86. public virtual void SetChillerCH1Temperature(float temperature)
  87. {
  88. }
  89. public virtual void SetChillerCH2Temperature(float temperature)
  90. {
  91. }
  92. public virtual void Terminate()
  93. {
  94. }
  95. public virtual void Monitor()
  96. {
  97. }
  98. public virtual void Reset()
  99. {
  100. }
  101. }
  102. }