MCToPCInfo.cs 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using TeamAAS_VP.Core.PLCs;
  7. namespace TeamAAS_VP.Models
  8. {
  9. public class MCToPCInfo
  10. {
  11. public string PlcIp { get; set; } = "192.1683.20";
  12. public int PlcPort { get; set; } = 4998;
  13. public bool PlcForwardEnabled { get; set; } = true;
  14. public string PlcPortDevice { get; set; } = "D101";
  15. public string PlcQualityDevice { get; set; } = "D102";
  16. public string PlcDataStartDevice { get; set; } = "D110";
  17. public string PlcReadyBitDevice { get; set; } = "M100";
  18. /// <summary>读 OK 位,填 0 表示不使用</summary>
  19. public string PlcOkBitDevice { get; set; } = "0";
  20. /// <summary>读 NG 位,填 0 表示不使用</summary>
  21. public string PlcNgBitDevice { get; set; } = "0";
  22. /// <summary>Receive 位(PC→PLC),填 0 表示不使用</summary>
  23. public string PlcReceiveBitDevice { get; set; } = "M103";
  24. /// <summary>PC 心跳地址:M 等位元件翻转,D 等字元件递增;填 0 表示不使用</summary>
  25. public string PlcHeartbeatDevice { get; set; } = "M200";
  26. public int PlcHeartbeatIntervalMs { get; set; } = 1000;
  27. /// <summary>连接自检用的位地址(建议用梯形图未占用的 M,如 M3001)</summary>
  28. public string PlcBitTestDevice { get; set; } = "M3001";
  29. public int PlcMaxDataBytes { get; set; } = 32;
  30. public PlcRfidMapping ToPlcMapping()
  31. {
  32. return new PlcRfidMapping
  33. {
  34. PortDevice = PlcPortDevice,
  35. QualityDevice = PlcQualityDevice,
  36. DataStartDevice = PlcDataStartDevice,
  37. ReadyBitDevice = PlcReadyBitDevice,
  38. OkBitDevice = PlcOkBitDevice,
  39. NgBitDevice = PlcNgBitDevice,
  40. ReceiveBitDevice = PlcReceiveBitDevice,
  41. MaxDataBytes = PlcMaxDataBytes
  42. };
  43. }
  44. }
  45. }