DeviceType.cs 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. namespace APS7100TestTool.Models
  2. {
  3. /// <summary>
  4. /// 设备类型枚举
  5. /// </summary>
  6. public enum DeviceType
  7. {
  8. APS7100, // AC 可编程电源
  9. PSW250 // DC 可编程电源
  10. }
  11. /// <summary>
  12. /// 设备信息
  13. /// </summary>
  14. public class DeviceInfo
  15. {
  16. public DeviceType Type { get; set; }
  17. public string Name { get; set; } = string.Empty;
  18. public string Description { get; set; } = string.Empty;
  19. public string VoltageRange { get; set; } = string.Empty;
  20. public string CurrentRange { get; set; } = string.Empty;
  21. public bool HasFrequencyControl { get; set; }
  22. public bool HasWaveformControl { get; set; }
  23. public static DeviceInfo GetDeviceInfo(DeviceType type)
  24. {
  25. return type switch
  26. {
  27. DeviceType.APS7100 => new DeviceInfo
  28. {
  29. Type = DeviceType.APS7100,
  30. Name = "APS-7100",
  31. Description = "AC 可编程电源 (1kVA)",
  32. VoltageRange = "0-350 Vrms",
  33. CurrentRange = "限流保护",
  34. HasFrequencyControl = true,
  35. HasWaveformControl = true
  36. },
  37. DeviceType.PSW250 => new DeviceInfo
  38. {
  39. Type = DeviceType.PSW250,
  40. Name = "PSW250-4.5",
  41. Description = "DC 可编程电源 (250W)",
  42. VoltageRange = "0-72 V",
  43. CurrentRange = "0-4.5 A",
  44. HasFrequencyControl = false,
  45. HasWaveformControl = false
  46. },
  47. _ => throw new System.ArgumentException("未知的设备类型")
  48. };
  49. }
  50. }
  51. }