AITCylinderData.cs 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. using System.Runtime.Serialization;
  2. namespace OldWorldData.CommonData.DeviceData
  3. {
  4. public enum CylinderState
  5. {
  6. Close = 0,
  7. Open = 1,
  8. Unknown = 2,
  9. Error = 3,
  10. }
  11. [DataContract]
  12. [Serializable]
  13. public class AITCylinderData
  14. {
  15. [DataMember]
  16. public string Module { get; set; }
  17. [DataMember]
  18. public string DeviceName { get; set; }
  19. [DataMember]
  20. public string DisplayName { get; set; } = "Undefined Cylinder";
  21. [DataMember]
  22. public string DeviceSchematicId { get; set; }
  23. [DataMember]
  24. public bool OpenFeedback { get; set; }
  25. [DataMember]
  26. public bool CloseFeedback { get; set; }
  27. [DataMember]
  28. public bool OpenSetPoint { get; set; }
  29. [DataMember]
  30. public bool CloseSetPoint { get; set; }
  31. [DataMember]
  32. public bool IsLoop { get; set; }
  33. public string StringStatus
  34. {
  35. get
  36. {
  37. if (OpenFeedback && !CloseFeedback) return CylinderState.Open.ToString();
  38. if (!OpenFeedback && CloseFeedback) return CylinderState.Close.ToString();
  39. if (OpenFeedback && CloseFeedback) return CylinderState.Error.ToString();
  40. if (!OpenFeedback && !CloseFeedback) return CylinderState.Unknown.ToString();
  41. return "Unknown";
  42. }
  43. }
  44. public string StringSetPoint
  45. {
  46. get
  47. {
  48. if (OpenSetPoint && !CloseSetPoint) return CylinderState.Open.ToString();
  49. if (!OpenSetPoint && CloseSetPoint) return CylinderState.Close.ToString();
  50. if (OpenSetPoint && CloseSetPoint) return CylinderState.Error.ToString();
  51. if (!OpenSetPoint && !CloseSetPoint) return CylinderState.Unknown.ToString();
  52. return "Unknown";
  53. }
  54. }
  55. }
  56. public class AITCylinderOperation
  57. {
  58. public const string Open = "Open";
  59. public const string Close = "Close";
  60. }
  61. public class AITCylinderProperty
  62. {
  63. public const string OpenFeedback = "OpenFeedback";
  64. public const string CloseFeedback = "CloseFeedback";
  65. public const string OpenSetPoint = "OpenSetPoint";
  66. public const string CloseSetPoint = "CloseSetPoint";
  67. }
  68. }