Permanent magnet synchronous motor controller