Model predictive control solution for permanent magnet synchronous motors