PumpBase.cs 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  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 abstract class PumpBase : BaseDevice, IDevice
  19. {
  20. public virtual bool IsOn { get; set; }
  21. public virtual bool IsError { get; set; }
  22. public virtual bool IsStable { get; set; }
  23. public virtual bool IsOverTemperature { get; set; }
  24. public virtual float Speed { get; set; }
  25. public virtual float Temperature { get; set; }
  26. public virtual AITPumpData DeviceData { get; set; }
  27. protected PumpBase() : base()
  28. {
  29. }
  30. protected PumpBase(string module, string name) : base(module, name, name, name)
  31. {
  32. }
  33. public virtual bool Initialize()
  34. {
  35. DATA.Subscribe($"{Module}.{Name}.DeviceData", () => DeviceData);
  36. DATA.Subscribe($"{Module}.{Name}.IsOn", () => IsOn);
  37. DATA.Subscribe($"{Module}.{Name}.IsError", () => IsError);
  38. DATA.Subscribe($"{Module}.{Name}.IsOverTemperature", () => IsOverTemperature);
  39. DATA.Subscribe($"{Module}.{Name}.Speed", () => Speed);
  40. DATA.Subscribe($"{Module}.{Name}.Temperature", () => Temperature);
  41. OP.Subscribe($"{Module}.{Name}.SetPumpOn", (function, args) =>
  42. {
  43. SetPumpOnOff(true);
  44. return true;
  45. });
  46. OP.Subscribe($"{Module}.{Name}.SetPumpOff", (function, args) =>
  47. {
  48. SetPumpOnOff(false);
  49. return true;
  50. });
  51. OP.Subscribe($"{Module}.{Name}.PumpOn", (function, args) =>
  52. {
  53. SetPumpOnOff(true);
  54. return true;
  55. });
  56. OP.Subscribe($"{Module}.{Name}.PumpOff", (function, args) =>
  57. {
  58. SetPumpOnOff(false);
  59. return true;
  60. });
  61. return true;
  62. }
  63. public virtual void SetPumpOnOff(bool isOn)
  64. {
  65. }
  66. public virtual void Terminate()
  67. {
  68. }
  69. public virtual void Monitor()
  70. {
  71. }
  72. public virtual void Reset()
  73. {
  74. }
  75. }
  76. }