IPhotoVoltaicInverterHandler.cs 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Text;
  4. using System.Threading.Tasks;
  5. namespace Edge.Core.IndustryStandardInterface.PhotoVoltaicInverter
  6. {
  7. public interface IPhotoVoltaicInverterHandler
  8. {
  9. public event EventHandler OnDeviceError;
  10. public IEnumerable<InverterDevice> GetDevices();
  11. public Task<InverterDeviceRealTimeData> ReadRealTimeDataAsync(byte deviceSlaveAddress);
  12. //public Task<object> RawSendOutgoingQueryMessageAsync(byte deviceSlaveAddress, FunctionCodeEnum functionCode, int startingRegAddress, byte noOfRegAddress);
  13. }
  14. public class InverterDeviceRealTimeData
  15. {
  16. //public InverterDevice Device { get; set; }
  17. //public byte[] DeviceTypeCode { get; set; }
  18. public decimal 日有功发电量 { get; set; }
  19. public decimal 日无功发电量 { get; set; }
  20. /// <summary>
  21. /// kWh
  22. /// </summary>
  23. public decimal 总发电量 { get; set; }
  24. /// <summary>
  25. /// hour
  26. /// </summary>
  27. public decimal 总运行时间 { get; set; }
  28. /// <summary>
  29. ///
  30. /// </summary>
  31. public decimal 机内空气温度 { get; set; }
  32. public string Description { get; set; }
  33. public string ToLogString()
  34. {
  35. return $"日有功发电量(kWh): {this.日有功发电量}, 日无功发电量(kWh): {this.日无功发电量}, 总发电量(kWh): {this.总发电量}, 总运行时间(hour): {this.总运行时间}, 机内空气温度(C): {this.机内空气温度}";
  36. }
  37. }
  38. public class InverterDevice
  39. {
  40. public InverterDevice(string name, byte slaveAddress)
  41. {
  42. this.Name = name;
  43. this.SlaveAddress = slaveAddress;
  44. }
  45. public string Name { get; private set; }
  46. public bool IsOnline { get; set; }
  47. public byte SlaveAddress { get; private set; }
  48. /// <summary>
  49. /// 设备类型码
  50. /// read by register address 5000
  51. /// </summary>
  52. //public byte[] DeviceTypeCode { get; set; }
  53. /// <summary>
  54. /// SN 序列号
  55. /// read by register address 4990
  56. /// </summary>
  57. //public string DeviceSN { get; set; }
  58. /// <summary>
  59. /// used for track the last received message which for caculate the offline state of this device.
  60. /// </summary>
  61. public DateTime? LastIncomingMessageReceivedTime { get; set; }
  62. public string Description { get; set; }
  63. }
  64. }