| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157 |
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Runtime.CompilerServices;
- namespace TeamAAS.Feeder.Models
- {
- /// <summary>
- /// 料斗(输入输出)参数:对应设备地址 742+8*n 起的 8 个参数。
- /// 数字量输出1/2、模拟量输出1/2、料斗振动振幅/频率/波形、振动持续时间。
- /// </summary>
- public class HopperOutputParam : INotifyPropertyChanged
- {
- private bool _hopperDigitalOutput1;
- [Category("料斗输出"), DisplayName("数字量输出1")]
- public bool HopperDigitalOutput1
- {
- get { return _hopperDigitalOutput1; }
- set { SetProperty(ref _hopperDigitalOutput1, value); }
- }
- private int _hopperAnalogOutput1;
- [Category("料斗输出"), DisplayName("模拟量输出1")]
- public int HopperAnalogOutput1
- {
- get { return _hopperAnalogOutput1; }
- set { SetProperty(ref _hopperAnalogOutput1, value); }
- }
- private bool _hopperDigitalOutput2;
- [Category("料斗输出"), DisplayName("数字量输出2")]
- public bool HopperDigitalOutput2
- {
- get { return _hopperDigitalOutput2; }
- set { SetProperty(ref _hopperDigitalOutput2, value); }
- }
- private int _hopperAnalogOutput2;
- [Category("料斗输出"), DisplayName("模拟量输出2")]
- public int HopperAnalogOutput2
- {
- get { return _hopperAnalogOutput2; }
- set { SetProperty(ref _hopperAnalogOutput2, value); }
- }
- private int _hopperVibrationAmpl;
- [Category("料斗振动"), DisplayName("振幅")]
- public int HopperVibrationAmpl
- {
- get { return _hopperVibrationAmpl; }
- set { SetProperty(ref _hopperVibrationAmpl, value); }
- }
- private int _hopperVibrationFreq;
- [Category("料斗振动"), DisplayName("频率")]
- public int HopperVibrationFreq
- {
- get { return _hopperVibrationFreq; }
- set { SetProperty(ref _hopperVibrationFreq, value); }
- }
- private int _hopperVibrationWaveform;
- [Category("料斗振动"), DisplayName("波形")]
- public int HopperVibrationWaveform
- {
- get { return _hopperVibrationWaveform; }
- set { SetProperty(ref _hopperVibrationWaveform, value); }
- }
- private int _hopperDuration = 500;
- [Category("料斗输出"), DisplayName("振动持续时间(ms)")]
- public int HopperDuration
- {
- get { return _hopperDuration; }
- set { SetProperty(ref _hopperDuration, value); }
- }
- public HopperOutputParam Clone()
- {
- return new HopperOutputParam
- {
- HopperDigitalOutput1 = HopperDigitalOutput1,
- HopperAnalogOutput1 = HopperAnalogOutput1,
- HopperDigitalOutput2 = HopperDigitalOutput2,
- HopperAnalogOutput2 = HopperAnalogOutput2,
- HopperVibrationAmpl = HopperVibrationAmpl,
- HopperVibrationFreq = HopperVibrationFreq,
- HopperVibrationWaveform = HopperVibrationWaveform,
- HopperDuration = HopperDuration,
- };
- }
- public event PropertyChangedEventHandler PropertyChanged;
- protected virtual bool SetProperty<T>(ref T storage, T value, [CallerMemberName] string propertyName = null)
- {
- if (EqualityComparer<T>.Default.Equals(storage, value)) return false;
- storage = value;
- PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
- return true;
- }
- }
- /// <summary>
- /// 系统参数(超时相关):背光超时/亮度/闪烁、平台振动超时、料斗振动超时。
- /// 对应设备全局参数地址 44 / 34 / 33 / 65 / 66,写入后经 {DG} 存至非易失内存。
- /// </summary>
- public class FeederSystemParam : INotifyPropertyChanged
- {
- private ushort _lightTimeout = 3000;
- [Category("背光"), DisplayName("背光超时(ms)")]
- public ushort LightTimeout
- {
- get { return _lightTimeout; }
- set { SetProperty(ref _lightTimeout, value); }
- }
- private ushort _lightBrightness = 80;
- [Category("背光"), DisplayName("光源亮度(%)")]
- public ushort LightBrightness
- {
- get { return _lightBrightness; }
- set { SetProperty(ref _lightBrightness, value); }
- }
- private ushort _lightFlashTime = 500;
- [Category("背光"), DisplayName("背光闪烁时间(ms)")]
- public ushort LightFlashTime
- {
- get { return _lightFlashTime; }
- set { SetProperty(ref _lightFlashTime, value); }
- }
- private ushort _platShakeTimeout = 5000;
- [Category("振动超时"), DisplayName("平台振动超时(ms)")]
- public ushort PlatShakeTimeout
- {
- get { return _platShakeTimeout; }
- set { SetProperty(ref _platShakeTimeout, value); }
- }
- private ushort _hopperShakeTimeout = 5000;
- [Category("振动超时"), DisplayName("料斗振动超时(ms)")]
- public ushort HopperShakeTimeout
- {
- get { return _hopperShakeTimeout; }
- set { SetProperty(ref _hopperShakeTimeout, value); }
- }
- public event PropertyChangedEventHandler PropertyChanged;
- protected virtual bool SetProperty<T>(ref T storage, T value, [CallerMemberName] string propertyName = null)
- {
- if (EqualityComparer<T>.Default.Equals(storage, value)) return false;
- storage = value;
- PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
- return true;
- }
- }
- }
|