tachometric curve calculation code