Thermal modeling of permanent magnet synchronous motor and inverter