BeckhoffVelocityUtil.cs 998 B

123456789101112131415161718192021222324252627282930313233343536
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. namespace MECF.Framework.Common.Utilities
  7. {
  8. public class BeckhoffVelocityUtil
  9. {
  10. /// <summary>
  11. /// 速度RPM转换成Count/s
  12. /// </summary>
  13. /// <param name="rpm"></param>
  14. /// <param name="scale"></param>
  15. /// <returns></returns>
  16. public static int ConvertVelocityToCountPerSecondByRPM(int rpm,double scale)
  17. {
  18. double rps = (double)rpm / 60;
  19. double degs = rpm * 360;
  20. return (int)Math.Round(rps * scale,0);
  21. }
  22. /// <summary>
  23. /// 速度RPM转换成deg/s
  24. /// </summary>
  25. /// <param name="rpm"></param>
  26. /// <returns></returns>
  27. public static double ConvertVelocityToDegPerSecondByRPM(int rpm)
  28. {
  29. double rps = (double)rpm / 60;
  30. double degs = rps * 360;
  31. return degs;
  32. }
  33. }
  34. }