PressureGaugeBase.cs 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using System.Xml;
  7. using Aitex.Core.Common.DeviceData;
  8. using Aitex.Core.RT.DataCenter;
  9. using Aitex.Core.RT.Device;
  10. using Aitex.Core.RT.Event;
  11. using Aitex.Core.RT.IOCore;
  12. using Aitex.Core.RT.OperationCenter;
  13. using Aitex.Core.RT.SCCore;
  14. using Aitex.Core.RT.Tolerance;
  15. using Aitex.Core.Util;
  16. namespace MECF.Framework.Common.Device.Bases
  17. {
  18. public abstract class PressureGaugeBase : BaseDevice, IDevice
  19. {
  20. public string Unit
  21. {
  22. get; set;
  23. }
  24. public virtual float SetPoint { get; set; }
  25. public virtual float FeedBack { get; set; }
  26. public virtual string FormatString { get; set; }
  27. public virtual AITPressureMeterData DeviceData
  28. {
  29. get
  30. {
  31. AITPressureMeterData data = new AITPressureMeterData()
  32. {
  33. Module = Module,
  34. DeviceName = Name,
  35. DeviceSchematicId = DeviceID,
  36. DisplayName = Display,
  37. FeedBack = FeedBack,
  38. FormatString = FormatString,
  39. };
  40. return data;
  41. }
  42. }
  43. public PressureGaugeBase( ):base()
  44. {
  45. }
  46. public PressureGaugeBase(string module, XmlElement node, string ioModule = "")
  47. {
  48. Unit = node.GetAttribute("unit");
  49. base.Module = string.IsNullOrEmpty(node.GetAttribute("module")) ? module : node.GetAttribute("module");
  50. base.Name = node.GetAttribute("id");
  51. base.Display = node.GetAttribute("display");
  52. base.DeviceID = node.GetAttribute("schematicId");
  53. }
  54. public virtual bool Initialize()
  55. {
  56. DATA.Subscribe($"{Module}.{Name}.DeviceData", () => DeviceData);
  57. DATA.Subscribe($"{Module}.{Name}.FeedBack", () => FeedBack);
  58. return true;
  59. }
  60. public virtual void Monitor()
  61. {
  62. }
  63. public virtual void Reset()
  64. {
  65. }
  66. public virtual void Terminate()
  67. {
  68. }
  69. }
  70. }