AITThrottleValveData.cs 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  1. using System;
  2. using System.CodeDom;
  3. using System.Collections.Generic;
  4. using System.ComponentModel;
  5. using System.Globalization;
  6. using System.Linq;
  7. using System.Reflection;
  8. using System.Runtime.Serialization;
  9. using System.Text;
  10. using System.Windows.Data;
  11. using System.Windows.Input;
  12. using Aitex.Core.UI.MVVM;
  13. using MECF.Framework.Common.CommonData;
  14. namespace Aitex.Core.Common.DeviceData
  15. {
  16. [Serializable]
  17. [DataContract]
  18. public enum PressureCtrlMode
  19. {
  20. [EnumMember]
  21. Undefined = 0,
  22. [EnumMember]
  23. TVPressureCtrl = 1,
  24. [EnumMember]
  25. TVPositionCtrl = 2,
  26. [EnumMember]
  27. TVOpen = 3,
  28. [EnumMember]
  29. TVClose = 4,
  30. [EnumMember]
  31. TVCalib = 5,
  32. }
  33. [DataContract]
  34. [Serializable]
  35. public class AITThrottleValveData : NotifiableItem, IDeviceData
  36. {
  37. [DataMember]
  38. public string Module { get; set; }
  39. [DataMember]
  40. public string DeviceName { get; set; }
  41. [DataMember]
  42. public string DisplayName { get; set; }
  43. [DataMember]
  44. public string DeviceSchematicId { get; set; }
  45. [DataMember]
  46. public string UnitPosition { get; set; }
  47. [DataMember]
  48. public string UnitPressure { get; set; }
  49. [DataMember]
  50. public string Description { get; set; }
  51. /// <summary>
  52. /// 量程
  53. /// </summary>
  54. [DataMember]
  55. public double MaxValuePosition { get; set; }
  56. [DataMember]
  57. public double MaxValuePressure { get; set; }
  58. /// <summary>
  59. /// MFC,PC
  60. /// </summary>
  61. [DataMember]
  62. public string Type { get; set; }
  63. [DataMember]
  64. public double Factor { get; set; }
  65. [DataMember]
  66. public int Mode { get; set; }
  67. [DataMember]
  68. public float PositionFeedback { get; set; }
  69. [DataMember]
  70. public float PressureFeedback { get; set; }
  71. [DataMember]
  72. public float PressureSetPoint { get; set; }
  73. [DataMember]
  74. public float PositionSetPoint { get; set; }
  75. [DataMember]
  76. public int State { get; set; }
  77. public string TextMode
  78. {
  79. get
  80. {
  81. switch (Mode)
  82. {
  83. case (int)(PressureCtrlMode.TVPositionCtrl):
  84. return "Position";
  85. case (int)(PressureCtrlMode.TVPressureCtrl):
  86. return "Pressure";
  87. case (int)(PressureCtrlMode.TVOpen):
  88. return "Open";
  89. case (int)(PressureCtrlMode.TVClose):
  90. return "Close";
  91. default:
  92. return "Undefined";
  93. }
  94. }
  95. }
  96. public AITThrottleValveData()
  97. {
  98. DisplayName = "Undefined";
  99. Factor = 1.0;
  100. UnitPosition = "%";
  101. UnitPressure = "mTorr";
  102. Type = "TV";
  103. MaxValuePosition = 100;
  104. MaxValuePressure = 1000;
  105. }
  106. public void Update(IDeviceData data)
  107. {
  108. throw new NotImplementedException();
  109. }
  110. }
  111. public enum AITThrottleValveOperation
  112. {
  113. SetMode,
  114. SetPosition,
  115. SetPressure,
  116. }
  117. public class AITThrottleValvePropertyName
  118. {
  119. public const string TVPositionSetPoint = "TVPositionSetPoint";
  120. public const string TVPosition = "TVPosition";
  121. public const string TVPressureSetPoint = "TVPressureSetPoint";
  122. public const string TVPressure = "TVPressure";
  123. }
  124. public class PressureCtrlModeConverter : IValueConverter
  125. {
  126. public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
  127. {
  128. if (value == null)
  129. {
  130. return null;
  131. }
  132. var status = (PressureCtrlMode)value;
  133. switch (status)
  134. {
  135. case PressureCtrlMode.TVOpen:
  136. return "Open";
  137. case PressureCtrlMode.TVClose:
  138. return "Close";
  139. case PressureCtrlMode.TVPositionCtrl:
  140. return "Position";
  141. case PressureCtrlMode.TVPressureCtrl:
  142. return "Pressure";
  143. case PressureCtrlMode.TVCalib:
  144. return "Calibration";
  145. case PressureCtrlMode.Undefined:
  146. return "Unknown";
  147. default:
  148. break;
  149. }
  150. return null;
  151. }
  152. public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
  153. {
  154. throw new NotImplementedException();
  155. }
  156. }
  157. }