Real-time Thermal Observer for Electric Machines