PlatingCellOverflowLevelCurve.cs 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. using Aitex.Core.Util;
  2. using PunkHPX8_RT.Devices.Reservoir;
  3. using System;
  4. using System.Collections.Generic;
  5. using System.Linq;
  6. using System.Text;
  7. using System.Threading.Tasks;
  8. namespace PunkHPX8_RT.Devices.PlatingCell
  9. {
  10. public class PlatingCellOverflowLevelCurve : Singleton<PlatingCellOverflowLevelCurve>
  11. {
  12. /// <summary>
  13. /// 计算Level
  14. /// </summary>
  15. /// <param name="current"></param>
  16. /// <param name="levelCurve"></param>
  17. /// <returns></returns>
  18. public double CalculateLevelByCurrent(double current, string levelCurve)
  19. {
  20. string[] strAry = levelCurve.Split(',', ',');
  21. if (strAry.Length >= 3)
  22. {
  23. double.TryParse(strAry[strAry.Length - 1], out double c);
  24. double.TryParse(strAry[strAry.Length - 2], out double b);
  25. double.TryParse(strAry[strAry.Length - 3], out double a);
  26. return a * (current - b) + c;
  27. }
  28. else
  29. {
  30. return 0;
  31. }
  32. }
  33. }
  34. }