ChillerBase.cs 2.7 KB

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