SimulatorMotionData.cs 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224
  1. using MECF.Framework.Common.CommonData;
  2. using System.Runtime.Serialization;
  3. namespace MECF.Framework.Common.Simulator
  4. {
  5. /// <summary>
  6. /// 电机运动阶段
  7. /// </summary>
  8. public enum MotionPhase
  9. {
  10. Accelerating,
  11. Decelerating,
  12. ConstantSpeed
  13. };
  14. [DataContract]
  15. public class SimulatorMotionData : NotifiableItem
  16. {
  17. #region 属性
  18. [DataMember]
  19. public bool SwitchSignal
  20. {
  21. get { return _switchSignal; }
  22. set { _switchSignal = value; InvokePropertyChanged(nameof(SwitchSignal)); }
  23. }
  24. [DataMember]
  25. public byte StopCode
  26. {
  27. get { return _stopCode; }
  28. set { _stopCode = value; InvokePropertyChanged(nameof(StopCode)); }
  29. }
  30. [DataMember]
  31. public int PositionError
  32. {
  33. get { return _positionError; }
  34. set { _positionError = value; InvokePropertyChanged(nameof(StopCode)); }
  35. }
  36. [DataMember]
  37. public int ActualPosition
  38. {
  39. get { return _actualPosition; }
  40. set { _actualPosition = value; InvokePropertyChanged(nameof(ActualPosition)); }
  41. }
  42. [DataMember]
  43. public int ActualVelocity
  44. {
  45. get { return _actualVelocity; }
  46. set { _actualVelocity = value; InvokePropertyChanged(nameof(ActualVelocity)); }
  47. }
  48. [DataMember]
  49. public int ActualAccel
  50. {
  51. get { return _actualAccel; }
  52. set { _actualAccel = value; InvokePropertyChanged(nameof(ActualAccel)); }
  53. }
  54. [DataMember]
  55. public int ActualDecel
  56. {
  57. get { return _actualDecel; }
  58. set { _actualDecel = value; InvokePropertyChanged(nameof(ActualDecel)); }
  59. }
  60. [DataMember]
  61. public short ActualTorque
  62. {
  63. get { return _actualTorque; }
  64. set { _actualTorque = value; InvokePropertyChanged(nameof(ActualTorque)); }
  65. }
  66. [DataMember]
  67. public int TargetPosition
  68. {
  69. get { return _targetPosition; }
  70. set { _targetPosition = value; InvokePropertyChanged(nameof(TargetPosition)); }
  71. }
  72. [DataMember]
  73. public int TargetVelocity
  74. {
  75. get { return _targetVelocity; }
  76. set { _targetVelocity = value; InvokePropertyChanged(nameof(TargetVelocity)); }
  77. }
  78. [DataMember]
  79. public int TargetAccel
  80. {
  81. get { return _targetAccel; }
  82. set { _targetAccel = value; InvokePropertyChanged(nameof(TargetAccel)); }
  83. }
  84. [DataMember]
  85. public int TargetDecel
  86. {
  87. get { return _targetDecel; }
  88. set { _targetDecel = value; InvokePropertyChanged(nameof(TargetDecel)); }
  89. }
  90. [DataMember]
  91. public short TargetTorque
  92. {
  93. get { return _targetTorque; }
  94. set { _targetTorque = value; InvokePropertyChanged(nameof(TargetTorque)); }
  95. }
  96. [DataMember]
  97. public int HomingVelocity
  98. {
  99. get { return _homingVelocity; }
  100. set { _homingVelocity = value; InvokePropertyChanged(nameof(HomingVelocity)); }
  101. }
  102. [DataMember]
  103. public int HomingOffSet
  104. {
  105. get { return _homingOffSet; }
  106. set { _homingOffSet = value; InvokePropertyChanged(nameof(HomingOffSet)); }
  107. }
  108. [DataMember]
  109. public int HomingTimeout
  110. {
  111. get { return _homingTimeOut; }
  112. set { _homingTimeOut = value; InvokePropertyChanged(nameof(HomingTimeout)); }
  113. }
  114. [DataMember]
  115. public int HomingAccel
  116. {
  117. get { return _homingAccel; }
  118. set { _homingAccel = value; InvokePropertyChanged(nameof(HomingAccel)); }
  119. }
  120. [DataMember]
  121. public int HomingDecel
  122. {
  123. get { return _homingDecel; }
  124. set { _homingDecel = value; InvokePropertyChanged(nameof(HomingDecel)); }
  125. }
  126. [DataMember]
  127. public int RevSoftLimit
  128. {
  129. get { return _revSoftLimit; }
  130. set { _revSoftLimit = value; InvokePropertyChanged(nameof(RevSoftLimit)); }
  131. }
  132. [DataMember]
  133. public int FwdSoftLimit
  134. {
  135. get { return _fwdSoftLimit; }
  136. set { _fwdSoftLimit = value; InvokePropertyChanged(nameof(FwdSoftLimit)); }
  137. }
  138. [DataMember]
  139. public int NegativeTorqueLimit
  140. {
  141. get { return _negativeTorqueLimit; }
  142. set { _negativeTorqueLimit = value; InvokePropertyChanged(nameof(NegativeTorqueLimit)); }
  143. }
  144. [DataMember]
  145. public int PositiveTorqueLimit
  146. {
  147. get { return _positiveTorqueLimit; }
  148. set { _positiveTorqueLimit = value; InvokePropertyChanged(nameof(PositiveTorqueLimit)); }
  149. }
  150. [DataMember]
  151. public bool HomingSignal
  152. {
  153. get { return _homingSignal; }
  154. set { _homingSignal = value; InvokePropertyChanged(nameof(HomingSignal)); }
  155. }
  156. [DataMember]
  157. public bool MotionSignal
  158. {
  159. get { return _motionSignal; }
  160. set { _motionSignal = value; InvokePropertyChanged(nameof(MotionSignal)); }
  161. }
  162. [DataMember]
  163. public MotionPhase MotionPhase
  164. {
  165. get { return _motionPhase; }
  166. set { _motionPhase = value; InvokePropertyChanged(nameof(MotionPhase)); }
  167. }
  168. [DataMember]
  169. public bool StopSignal
  170. {
  171. get { return _stopSignal; }
  172. set { _stopSignal = value; InvokePropertyChanged(nameof(StopSignal)); }
  173. }
  174. #endregion
  175. #region 内部变量
  176. #region Signal
  177. private bool _switchSignal;
  178. private bool _homingSignal;
  179. private bool _motionSignal;
  180. private bool _stopSignal;
  181. private MotionPhase _motionPhase;
  182. #endregion
  183. private byte _stopCode;
  184. private int _positionError;
  185. /// <summary>
  186. /// 实际参数
  187. /// </summary>
  188. private int _actualPosition;
  189. private int _actualVelocity;
  190. private int _actualAccel;
  191. private int _actualDecel;
  192. private short _actualTorque;
  193. /// <summary>
  194. /// 设定参数
  195. /// </summary>
  196. private int _targetPosition;
  197. private int _targetVelocity;
  198. private int _targetAccel;
  199. private int _targetDecel;
  200. private short _targetTorque;
  201. /// <summary>
  202. /// Home相关设定参数
  203. /// </summary>
  204. private int _homingVelocity;
  205. private int _homingOffSet;
  206. private int _homingTimeOut;
  207. private int _homingAccel;
  208. private int _homingDecel;
  209. private int _revSoftLimit;
  210. private int _fwdSoftLimit;
  211. private int _negativeTorqueLimit;
  212. private int _positiveTorqueLimit;
  213. #endregion
  214. }
  215. }