FeederParams.cs 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  1. using System.Collections.Generic;
  2. using System.ComponentModel;
  3. using System.Runtime.CompilerServices;
  4. namespace TeamAAS.Feeder.Models
  5. {
  6. /// <summary>
  7. /// 料斗(输入输出)参数:对应设备地址 742+8*n 起的 8 个参数。
  8. /// 数字量输出1/2、模拟量输出1/2、料斗振动振幅/频率/波形、振动持续时间。
  9. /// </summary>
  10. public class HopperOutputParam : INotifyPropertyChanged
  11. {
  12. private bool _hopperDigitalOutput1;
  13. [Category("料斗输出"), DisplayName("数字量输出1")]
  14. public bool HopperDigitalOutput1
  15. {
  16. get { return _hopperDigitalOutput1; }
  17. set { SetProperty(ref _hopperDigitalOutput1, value); }
  18. }
  19. private int _hopperAnalogOutput1;
  20. [Category("料斗输出"), DisplayName("模拟量输出1")]
  21. public int HopperAnalogOutput1
  22. {
  23. get { return _hopperAnalogOutput1; }
  24. set { SetProperty(ref _hopperAnalogOutput1, value); }
  25. }
  26. private bool _hopperDigitalOutput2;
  27. [Category("料斗输出"), DisplayName("数字量输出2")]
  28. public bool HopperDigitalOutput2
  29. {
  30. get { return _hopperDigitalOutput2; }
  31. set { SetProperty(ref _hopperDigitalOutput2, value); }
  32. }
  33. private int _hopperAnalogOutput2;
  34. [Category("料斗输出"), DisplayName("模拟量输出2")]
  35. public int HopperAnalogOutput2
  36. {
  37. get { return _hopperAnalogOutput2; }
  38. set { SetProperty(ref _hopperAnalogOutput2, value); }
  39. }
  40. private int _hopperVibrationAmpl;
  41. [Category("料斗振动"), DisplayName("振幅")]
  42. public int HopperVibrationAmpl
  43. {
  44. get { return _hopperVibrationAmpl; }
  45. set { SetProperty(ref _hopperVibrationAmpl, value); }
  46. }
  47. private int _hopperVibrationFreq;
  48. [Category("料斗振动"), DisplayName("频率")]
  49. public int HopperVibrationFreq
  50. {
  51. get { return _hopperVibrationFreq; }
  52. set { SetProperty(ref _hopperVibrationFreq, value); }
  53. }
  54. private int _hopperVibrationWaveform;
  55. [Category("料斗振动"), DisplayName("波形")]
  56. public int HopperVibrationWaveform
  57. {
  58. get { return _hopperVibrationWaveform; }
  59. set { SetProperty(ref _hopperVibrationWaveform, value); }
  60. }
  61. private int _hopperDuration = 500;
  62. [Category("料斗输出"), DisplayName("振动持续时间(ms)")]
  63. public int HopperDuration
  64. {
  65. get { return _hopperDuration; }
  66. set { SetProperty(ref _hopperDuration, value); }
  67. }
  68. public HopperOutputParam Clone()
  69. {
  70. return new HopperOutputParam
  71. {
  72. HopperDigitalOutput1 = HopperDigitalOutput1,
  73. HopperAnalogOutput1 = HopperAnalogOutput1,
  74. HopperDigitalOutput2 = HopperDigitalOutput2,
  75. HopperAnalogOutput2 = HopperAnalogOutput2,
  76. HopperVibrationAmpl = HopperVibrationAmpl,
  77. HopperVibrationFreq = HopperVibrationFreq,
  78. HopperVibrationWaveform = HopperVibrationWaveform,
  79. HopperDuration = HopperDuration,
  80. };
  81. }
  82. public event PropertyChangedEventHandler PropertyChanged;
  83. protected virtual bool SetProperty<T>(ref T storage, T value, [CallerMemberName] string propertyName = null)
  84. {
  85. if (EqualityComparer<T>.Default.Equals(storage, value)) return false;
  86. storage = value;
  87. PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
  88. return true;
  89. }
  90. }
  91. /// <summary>
  92. /// 系统参数(超时相关):背光超时/亮度/闪烁、平台振动超时、料斗振动超时。
  93. /// 对应设备全局参数地址 44 / 34 / 33 / 65 / 66,写入后经 {DG} 存至非易失内存。
  94. /// </summary>
  95. public class FeederSystemParam : INotifyPropertyChanged
  96. {
  97. private ushort _lightTimeout = 3000;
  98. [Category("背光"), DisplayName("背光超时(ms)")]
  99. public ushort LightTimeout
  100. {
  101. get { return _lightTimeout; }
  102. set { SetProperty(ref _lightTimeout, value); }
  103. }
  104. private ushort _lightBrightness = 80;
  105. [Category("背光"), DisplayName("光源亮度(%)")]
  106. public ushort LightBrightness
  107. {
  108. get { return _lightBrightness; }
  109. set { SetProperty(ref _lightBrightness, value); }
  110. }
  111. private ushort _lightFlashTime = 500;
  112. [Category("背光"), DisplayName("背光闪烁时间(ms)")]
  113. public ushort LightFlashTime
  114. {
  115. get { return _lightFlashTime; }
  116. set { SetProperty(ref _lightFlashTime, value); }
  117. }
  118. private ushort _platShakeTimeout = 5000;
  119. [Category("振动超时"), DisplayName("平台振动超时(ms)")]
  120. public ushort PlatShakeTimeout
  121. {
  122. get { return _platShakeTimeout; }
  123. set { SetProperty(ref _platShakeTimeout, value); }
  124. }
  125. private ushort _hopperShakeTimeout = 5000;
  126. [Category("振动超时"), DisplayName("料斗振动超时(ms)")]
  127. public ushort HopperShakeTimeout
  128. {
  129. get { return _hopperShakeTimeout; }
  130. set { SetProperty(ref _hopperShakeTimeout, value); }
  131. }
  132. public event PropertyChangedEventHandler PropertyChanged;
  133. protected virtual bool SetProperty<T>(ref T storage, T value, [CallerMemberName] string propertyName = null)
  134. {
  135. if (EqualityComparer<T>.Default.Equals(storage, value)) return false;
  136. storage = value;
  137. PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
  138. return true;
  139. }
  140. }
  141. }