ChillerBase.cs 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  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 ChillerBase : 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 IsRunning { get; set; }
  24. public virtual bool IsControl { get; set; }
  25. public virtual float Temperature { get; set; }
  26. public virtual AITChillerData DeviceData { get; set; }
  27. protected ChillerBase() : base()
  28. {
  29. }
  30. protected ChillerBase(string module, string name, string display, string id) : base(module, name, display, id)
  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}.Temperature", () => Temperature);
  38. OP.Subscribe($"{Module}.{Name}.SetPowerOnOff", (function, args) =>
  39. {
  40. bool isEnable = Convert.ToBoolean((string)args[0]);
  41. SetChillerOnOff(isEnable);
  42. return true;
  43. });
  44. OP.Subscribe($"{Module}.{Name}.ChillerOn", (function, args) =>
  45. {
  46. SetChillerOnOff(true);
  47. return true;
  48. });
  49. OP.Subscribe($"{Module}.{Name}.ChillerOff", (function, args) =>
  50. {
  51. SetChillerOnOff(false);
  52. return true;
  53. });
  54. OP.Subscribe($"{Module}.{Name}.Ramp", (function, args) =>
  55. {
  56. SetChillerTemp((float)Convert.ToDouble((string)args[0]), (float)Convert.ToDouble((string)args[1]));
  57. return true;
  58. });
  59. return true;
  60. }
  61. public virtual void SetChillerOnOff(bool isOn) { }
  62. public virtual void SetChillerTemp(float value, float offset) { }
  63. public virtual void Terminate() { }
  64. public virtual void Monitor() { }
  65. public virtual void Reset() { }
  66. }
  67. }