PumpBase.cs 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Diagnostics;
  4. using System.Timers;
  5. using Aitex.Core.Common.DeviceData;
  6. using Aitex.Core.RT.DataCenter;
  7. using Aitex.Core.RT.Device;
  8. using Aitex.Core.RT.OperationCenter;
  9. namespace MECF.Framework.Common.Device.Bases
  10. {
  11. public abstract class PumpBase: BaseDevice, IDevice
  12. {
  13. public virtual bool IsOn { get; set; }
  14. public virtual bool IsError { get; set; }
  15. public virtual bool IsStable { get; set; }
  16. public virtual bool IsRunning { get; set; }
  17. public virtual bool IsControl { get; set; }
  18. public virtual float Speed { get; set; }
  19. public virtual float Temperature { get; set; }
  20. public virtual AITPumpData DeviceData { get; set; }
  21. protected PumpBase() : base()
  22. {
  23. }
  24. protected PumpBase(string module, string name, string display, string id) : base(module, name, display, id)
  25. {
  26. }
  27. public virtual bool Initialize()
  28. {
  29. DATA.Subscribe($"{Module}.{Name}.DeviceData", () => DeviceData);
  30. DATA.Subscribe($"{Module}.{Name}.IsOn", () => IsOn);
  31. DATA.Subscribe($"{Module}.{Name}.Speed", () => Speed);
  32. DATA.Subscribe($"{Module}.{Name}.Temperature", () => Temperature);
  33. OP.Subscribe($"{Module}.{Name}.SetPumpOn", (function, args) =>
  34. {
  35. SetPumpOnOff(true);
  36. return true;
  37. });
  38. OP.Subscribe($"{Module}.{Name}.SetPumpOff", (function, args) =>
  39. {
  40. SetPumpOnOff(false);
  41. return true;
  42. });
  43. OP.Subscribe($"{Module}.{Name}.PumpOn", (function, args) =>
  44. {
  45. SetPumpOnOff(true);
  46. return true;
  47. });
  48. OP.Subscribe($"{Module}.{Name}.PumpOff", (function, args) =>
  49. {
  50. SetPumpOnOff(false);
  51. return true;
  52. });
  53. return true;
  54. }
  55. public virtual void SetPumpOnOff(bool isOn) { }
  56. public virtual void Terminate() { }
  57. public virtual void Monitor() { }
  58. public virtual void Reset() { }
  59. }
  60. //public abstract class TurboPump : PumpBase
  61. //{
  62. //}
  63. }