> For the complete documentation index, see [llms.txt](https://www.opal-rt.com/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://www.opal-rt.com/docs/smart-power-simulation-software-sps/example-models/motor-drives/field-oriented-control-of-an-interior-permanent-magnet-synchronous-motor.md).

# Field Oriented Control of an Interior Permanent Magnet Synchronous Motor

This example shows the wide-speed operation of an interior permanent magnet synchronous motor (IPMSM) drive. The drive uses a field-oriented control system with maximum torque per ampere (MTPA) and field-weakening control strategies.

<figure><img src="https://799605156-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdlNg8IbOdahCpFCyzxSN%2Fuploads%2Fgit-blob-f9d07e371375cfed7cb7be683c26df379ee9d101%2Ffiledorientedcontrol_interior_PMSM.png?alt=media" alt=""><figcaption></figcaption></figure>

## Description

IPMSMs are AC synchronous motors with permanent magnets embedded in their steel rotors. Compared to the surface-mounted PMSM motors, IPMSM motors are more robust and can be operated at much higher speed. In addition, an IPMSM motor shows a relatively high magnetic saliency, which allows the motor to benefit from both the magnetic and reluctance torque components.

IPMSM motors are typically controlled using field-oriented control scheme and fed with sinusoidal currents. The example also employs flux-weakening and MTPA control schemes.

### Electrical Model

A DC bus, modeled as an ideal DC source of 550 V, is connected to a three-phase, two-level converter. This converter generates the appropriate three-phase voltages (amplitude and frequency) for the speed regulation of the 50 kW IPMSM motor.

The converter is controlled by a field-oriented control (FOC) controller that generates the voltage references to a space-vector PWM modulator.

### Field-Oriented Control with Field-Weakening and MTPA

FOC is a control scheme in which a d-q coordinates reference frame that is locked to the motor flux space vector is used to achieve decoupling between the motor flux and torque. Consequently, they can be separately controlled by stator direct-axis and quadrature-axis currents, respectively.

The torque is at maximum when the flux produced by the magnets is perpendicular to the stator flux produced by the stator currents. In the field-oriented control scheme, the angle between these two fluxes is maintained at 90 degrees to produce maximum torque.

The torque developed by the motor is given by:

$$
T\_e = \frac{3}{2} p \left\[ \lambda, i\_q + (L\_d - L\_q), i\_d, i\_q \right]
$$

where

* *p* is the number of pole pairs.
* $$\lambda$$ is the flux induced by the permanent magnets in the stator windings.
* *L*<sub>*d*</sub> and *L*<sub>*q*</sub> are the d-axis and q-axis inductances.
* *i*<sub>*d*</sub> and *i*<sub>*q*</sub> are the d-axis and q-axis stator currents.

The equation is expressed in the rotor reference frame (the dq frame) and all quantities in the rotor reference frame are referred to the stator.

To operate the IPMSM motor at a speed higher than its nominal speed, the resulting back-EMF must be reduced in order not to exceed the maximum output voltage of the inverter. This reduction is performed by setting the d-axis stator current to a negative value to reduce the rotor flux linkage. This control strategy is called field-weakening control.

An IPMSM motor shows a relatively high magnetic saliency, which allows the motor to benefit from both the magnetic and reluctance torque components. The Maximum Torque Per Ampere MTPA algorithm calculates the d-axis and q-axis current components values to produce the desired torque while minimizing current magnitude. Additionally, the MTPA ensures that the inverter output does not saturate.

### Field-Oriented Control System

The main components of the FOC system are:

1. Speed Regulator - The regulator compares the actual motor speed to the speed reference. If the motor needs to be accelerated, the regulator increases the reference torque magnitude (Tref) in order to create more torque. On the contrary, if the motor speed is higher than the reference, the regulator reduces Tref. This reference torque value is then fed to the Torque Limiter block to reduce the reference torque as a function of the actual speed and the torque-speed characteristics of the motor.
2. Current measurement d-q conversion - Based on the rotor position (represented by the signal theta in the motor model), the measured three-phase stator currents are converted into their d-q coordinates in the rotor reference frame.
3. Current reference calculation - Based on the reference torque *T*<sub>*ref*</sub>, the actual motor speed, the estimated motor parameters, and the available supply voltage, this subsystem determines the optimized reference currents *Id*<sub>*ref*</sub> and *Iq*<sub>*ref*</sub> using the MTPA and field-weakening algorithms.
4. Current Regulators - The *Id*<sub>*ref*</sub> and the *Iq*<sub>*ref*</sub> reference currents are fed to the current regulators. The regulators process the measured and reference currents to produce the reference voltages, *V*<sub>*ref*</sub>. The regulators' dynamics benefit from a feedforward calculation of IPMSM currents based on the motor parameters.

The three-phase reference signals are connected to the PWM modulator that generates pulses for the motor inverter. The modulator uses the space vector PWM method with pulse averaging and a switching frequency of 8 kHz.

## Simulation

Specify a test number in the Test Number block and run the simulation. For test 3, specify a stop time of 10 s. You can observe simulation results in both Scope 1 and Scope 2.

**Test 1** : This test shows motor and generator operation in normal speed (1200 rpm) and overspeed mode (2400 rpm).

At 0.4 s, a load torque of 350 N.m. is applied to the motor. At 0.7 s, motor speed ramps to 2400 rpm and the load torque reduces to 150 N.m. The speed regulator performs well for both speed settings.

At 1.0 s, the load torque inverts from + 150 to -150 N.m so that the machine now operates as a generator.

**Test 2** : This test shows the impact of the MTPA control on the motor currents. At 0.4 s, a load torque of 350 N.m. is applied to the motor. At 0.8 s, the MTPA control turns off (Idref = 0). Without the MTPA algorithm, the magnitude of the motor currents increases while producing the same torque value. This results in more stator losses. Test 3: This test shows the wide-speed operation of the IPMSM motor from 0 rpm to 6000 rpm. The motor speed ramps to 6000 rpm while the torque reference is limited in order not to exceed motor ratings and to avoid saturation of the inverter output.

## Command

Example model name: power\_motordrive\_IPMSM\_FOC

{% code lineNumbers="true" %}

```matlab
open('power_motordrive_IPMSM_FOC')
```

{% endcode %}

## References

1. Tremblay, Olivier. Development Report: Parameters estimation and vector control of internal permanent magnet synchronous machine, ETS December 2010.
2. Jaszczolt, Christopher. Understanding permanent magnet motors. Control Engineering. January 2017.
3. Cirrincione, M., M. Pucci, G. Vitale. Power Converters and AC Electrical Drives with Linear Neural Networks. CRC Press, 2012.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://www.opal-rt.com/docs/smart-power-simulation-software-sps/example-models/motor-drives/field-oriented-control-of-an-interior-permanent-magnet-synchronous-motor.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
