I am building a simulation of Field Oriented Control of a PMSM in Simulink. The goal is to approximate the behaviour of a uController sampling the position of the rotor and the stator currents at 10kHz, and generating SVPWM signals at 10kHz to control a DC/AC converter connected to the motor. The motor parameters are from the PMSM Emrax 228 Medium Voltage (datasheet here). The controller's goal is to control the electromagnetic torque produced by the PMSM.

There is no speed control loop since the input of the controller is directly the torque generated by the motor. Also, the reference current Id is set to zero so that the torque may be directly controlled by Iq (given by T = 3/2 * #pair_poles * Phi_m * Iq). This is essentially equivalent to MTPA control given that Ld is practcaly equal to Lq for this PMSM.

The problem: The simulation results are complete garbage. The PI loops are unable to control the electromagnetic torque without ridiculous oscillation. As far as I know the FOC algorithm is implemented correctly, and so is the model of the motor. The PI gains may be incorrect, but the controller doesn't even seem to work with a simple P gain. I have tried various times to tune de PI gains with no success. I have also dabbled in changing the Simulink simulation settings (such as decreasing the maximum simulation step time), to no avail.

For the life of me, I can't figure out what is wrong. Why am I seeing these results?

Simulink file here.

  • \$\begingroup\$ Have you tried only 1/2 of the FOC loop, i.e. Vq = nonzero and Vd = 0, feed that into your inverse park, and make sure the motor model spins with a constant steady state velocity? (i.e. 'sinusoidal control') The inverse park -> SVPWM-> motor model is the meat of your simulation, and the most likely place where you would have issues. \$\endgroup\$
    – Ocanath
    Commented Sep 7, 2021 at 16:31
  • \$\begingroup\$ Could you add the file on cloud again, please? \$\endgroup\$
    – Almerico
    Commented Nov 21, 2021 at 1:21

1 Answer 1


In order to have a stable design you must have good feedback and model all physics of motor+load+driver +sensors. Since it is nonlinear, to have position control you need PID feedback from multiple sensors to achieve good phase margin.

Current is proportional to acceleration thus position is unstable as it 2nd integral.

Velocity feedback is V backEMF between active pulses.

Thus FOC design must use more than simple current feedback. Expand your research in this area.

  • \$\begingroup\$ My goal is not position control. My goal is torque control. \$\endgroup\$
    – Alex
    Commented Oct 26, 2017 at 8:39
  • \$\begingroup\$ “sampling the position” misled me to think that , sorry. Other than inertia and excitation inductive current, most of current ought to indicate torque. But if you Have insufficient or excessive filtering , a loop goes unstable. \$\endgroup\$ Commented Oct 26, 2017 at 18:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.