HeatingControl.cs 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. 
  2. using SHJX.Service.Model.Dao;
  3. using System.Collections.Generic;
  4. using SHJX.Service.Common.ReadXML;
  5. using SHJX.Service.Model.Control;
  6. using SHJX.Service.ServerClient.Interface;
  7. using SHJX.Service.ServerClient.TempController;
  8. using SHJX.Service.Common.Logging;
  9. using Microsoft.Extensions.Logging;
  10. namespace SHJX.Service.ServerClient.RS485Control
  11. {
  12. /// <summary>
  13. /// 加热
  14. /// </summary>
  15. public class HeatingControl : DeltaDtc, PortControlImp
  16. {
  17. private static readonly ILogger logger = LogFactory.BuildLogger(typeof(HeatingControl));
  18. /// <summary>
  19. /// 加热
  20. /// </summary>
  21. /// <param name="log">日志</param>
  22. /// <param name="config">配置</param>
  23. public HeatingControl( ReadConfigUtil config)
  24. : base( config) { }
  25. public object Read(PortArgs args)
  26. {
  27. double pv = 0;
  28. double sv = 0;
  29. ReadPVnSV(ref pv, ref sv);
  30. Dictionary<string, double> temp = new()
  31. {
  32. { "pv", pv },
  33. { "sv", sv }
  34. };
  35. return temp;
  36. }
  37. public bool Write(PortArgs args)
  38. {
  39. var pid = args.Reserve as PID;
  40. var res = WritePid(pid.Ratio, pid.Integral, pid.Differential, pid.DifferentialDeafult) && WriteSV(args.Distance);
  41. return res;
  42. }
  43. }
  44. }