The interior permanent-magnet synchronous motor (IPMSM) for variable speed applications became popular with the sensorless Field Oriented Control (FOC) technique in industrial and automotive systems because of high power density high efficiency and fast dynamic performance. This application report describes how to implement a flux-weakening logic and maximum torque per ampere (MTPA) logic in an I