Nonlinear optimal control of interior permanent magnet synchronous motors for electric vehicles