Abstract:[Objective] This paper focuses on the permanent magnet synchronous generator used in new energy vehicle range extenders. It addresses the issues of mechanical chattering caused by engine torque ripple and current distortion resulting from air-gap magnetic field distortion and inverter nonlinearities. The aim is to optimize motor control algorithms to enhance system robustness, thereby effectively suppressing vibration interference from the engine and torque ripple generated by the motor itself. [Methods] To improve the robustness of the speed outer loop and suppress chattering caused by engine torque ripple, the traditional PI controller was replaced by an improved sliding mode compensation controller. Meanwhile, to reduce the torque ripple inherent to the motor, a harmonic injection algorithm was introduced to specifically suppress the 5th and 7th current harmonics, thereby effectively mitigating the impact of harmonic currents. [Results] Simulation and experimental results indicated that significant improvements were achieved in both disturbance rejection performance and current quality by the proposed strategy. Under the condition of 500 r/min and a 120 N·m step load, the peak speed overshoot was reduced from 538 r/min to 532 r/min, compared with the traditional PI controller. Meanwhile, the 5th and 7th current harmonics were almost completely eliminated by the harmonic injection algorithm. The key harmonic current components, id5th, id7th, and iq7th, were all suppressed to 0, verifying the effectiveness of the proposed strategy. [Conclusion] The improved sliding mode controller enhances system robustness, enabling faster post-disturbance speed recovery and smaller fluctuations. Concurrently, the harmonic injection algorithm effectively suppresses current harmonics caused by inverter nonlinearities and motor magnetic field distortion, improving current quality. The combination of both achieves superior steady-state performance.