According to input parameters, a controller carries out: generation of a
voltage command value for each of d- and q-axes; conversion of the
voltage command value for each of the d- and q-axes into a
voltage command value for each of the multiphase windings; and control of a multiphase
inverter based on the voltage command value for each of the multiphase windings. The controller adds, to the voltage command value for the q-axis, a first compensation voltage value for compensating torque ripples to thereby output a compensated voltage command value for the q-axis. The first compensation voltage value contains m-th
harmonic components in the
AC motor and varies depending on the rotational angle of the rotor, the m corresponding to the number of phase of the multiphase windings. The controller uses, as the voltage command value for the q-axis, the compensated voltage command value for the q-axis.