PumpBase.cs 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Net.Configuration;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7. using System.Xml;
  8. using Aitex.Core.Common.DeviceData;
  9. using Aitex.Core.RT.DataCenter;
  10. using Aitex.Core.RT.Device;
  11. using Aitex.Core.RT.Event;
  12. using Aitex.Core.RT.IOCore;
  13. using Aitex.Core.RT.OperationCenter;
  14. using Aitex.Core.RT.SCCore;
  15. using Aitex.Core.Util;
  16. namespace MECF.Framework.Common.Device.Bases
  17. {
  18. public enum PumpRunStatus
  19. {
  20. Stop,
  21. Running
  22. }
  23. public enum ValveStatus
  24. {
  25. Closed,
  26. Opened
  27. }
  28. public enum PumpLLStatus
  29. {
  30. Off,
  31. On
  32. }
  33. public enum ControlMode
  34. {
  35. Local,
  36. Remote
  37. }
  38. public enum FaultResult
  39. {
  40. OK,
  41. Alert,
  42. Alarm
  43. }
  44. public abstract class PumpBase : BaseDevice, IDevice
  45. {
  46. public virtual bool IsOn { get; set; }
  47. public virtual bool IsError { get; set; }
  48. public virtual bool IsStable { get; set; }
  49. public virtual bool IsOverTemperature { get; set; }
  50. public virtual float Speed { get; set; }
  51. public virtual float Temperature { get; set; }
  52. public virtual AITPumpData DeviceData { get; set; }
  53. protected PumpBase() : base()
  54. {
  55. }
  56. protected PumpBase(string module, string name) : base(module, name, name, name)
  57. {
  58. }
  59. public virtual bool Initialize()
  60. {
  61. DATA.Subscribe($"{Module}.{Name}.DeviceData", () => DeviceData);
  62. DATA.Subscribe($"{Module}.{Name}.IsOn", () => IsOn);
  63. DATA.Subscribe($"{Module}.{Name}.IsError", () => IsError);
  64. DATA.Subscribe($"{Module}.{Name}.IsOverTemperature", () => IsOverTemperature);
  65. DATA.Subscribe($"{Module}.{Name}.Speed", () => Speed);
  66. DATA.Subscribe($"{Module}.{Name}.Temperature", () => Temperature);
  67. OP.Subscribe($"{Module}.{Name}.SetPumpOn", (function, args) =>
  68. {
  69. SetPumpOnOff(true);
  70. return true;
  71. });
  72. OP.Subscribe($"{Module}.{Name}.SetPumpOff", (function, args) =>
  73. {
  74. SetPumpOnOff(false);
  75. return true;
  76. });
  77. OP.Subscribe($"{Module}.{Name}.PumpOn", (function, args) =>
  78. {
  79. SetPumpOnOff(true);
  80. return true;
  81. });
  82. OP.Subscribe($"{Module}.{Name}.PumpOff", (function, args) =>
  83. {
  84. SetPumpOnOff(false);
  85. return true;
  86. });
  87. return true;
  88. }
  89. public virtual void SetPumpOnOff(bool isOn)
  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. }