Robust fault detection for a permanent-magnet synchronous motor using a nonlinear observer