Electrical – Using Simulink to simulate FOC of a PMSM motor

motor controllerpmsmsimulink

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.

Best Answer

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.

Related Topic