Teaching Your PI Controller to Behave (Part IX)

Dave Wilson, Motion Products Evangelist, Texas Instruments

At last!  Let’s take what we have learned so far and see how it applies to Field Oriented Control (FOC) systems.  Figure 1 shows a typical field oriented system incorporating TI’s new FAST sensorless observer.  Recall from my last blog that FAST stands for Flux, Angle, Speed, and Torque.  As with most speed control systems based on FOC, this diagram utilizes three PI controllers; two for controlling the quadrature components of current, and one for controlling the velocity.

 Figure 1.  Typical FOC Speed Control of a PMSM

 The design of the velocity controller doesn’t change much in a field oriented system compared to other control algorithms.  But there are subtle differences which affect how you should design your current controllers, which are listed below.

1.  The motor’s equivalent RL circuit seen by the controllers (which determines how you set the PI coefficients) will vary depending on the motor type.  For BLDC and Permanent Magnet Synchronous Motors (PMSMs), R is simply the stator resistance, and L is the stator inductance.  As we have seen up to now, the PI coefficients are the same for the d and q current regulators.  But with AC Induction Motors (ACIMs), this is not the case.  For the d-axis, the resistance is equal to the stator resistance, just like it is with a PMSM.  But inspection of the rotor flux-based model of an AC induction motor reveals that the q-axis current controller sees an equivalent resistance equal to the stator resistance PLUS the rotor resistance.  Another difference is the inductance value you should use for both axes.  It turns out that it is not the stator inductance value, but rather the “series” inductance (or sometimes called the “leakage” inductance) which is defined as follows:

                                                Equ. 1

where:     L = the equivalent series inductance

               Ls = the stator inductance

               Lm = the magnetizing inductance

               Lr = the rotor inductance

               s = the “leakage factor” of the induction motor

Finally, it turns out that an IPM motor should be handled differently than either a PMSM or an ACIM.  The resistance value used by both the d and q axis current controllers is the stator resistance (just like any other PMSM).  The value used for inductance is the stator inductance, also similar to PMSMs.  But the stator inductance is different between the d and q axes, where Lq is usually larger than Ld due to the lower flux reluctance along that axis. 

In many cases these subtleties between motors won’t cause a big difference in the performance of your system, especially since you only have one pole in your current controller transfer function, and you can afford to be somewhat conservative.  But in higher performance, higher bandwidth systems, these subtleties must be considered, or you could end up with a PI current controller that is incompatible with your motor, resulting in less than optimal control.  As a first step in helping you manage all these different conditions, I have designed a spreadsheet which can help you calculate the PI coefficients as a function of motor type for a field-oriented system.  The white cells represent fields that you must populate with data, and the grey cells will be calculated automatically based on the data you enter.  Go ahead and try it!  Just be mindful to use the correct SI units listed in each column, or you will not get the results you want.

2.  It turns out that the control of the d-axis and q-axis currents are not independent from one another.  Within the motor, there is a natural cross coupling between the d-axis and q-axis which can be seen in the differential equations below for a PMSM:

                                               Equ. 2

                                 Equ. 3

where:     R is the stator resistance

               Ls is the stator inductance

               D is the differential operator

               w is the electrical frequency

               Ke = the Back EMF constant

From equation 2 we see that Vd is not the only voltage term vying for control of the d-axis current.   There is also a speed dependent term which contains iq in it.  From equation 3, Vq is also competing with a voltage term containing id.  For both regulators, this cross-coupling effect manifests itself as an unwanted disturbance which is most prominent during transient conditions at high speeds.  To correct for this situation, feed-forward decoupling can be applied to each axis which exactly cancels these cross-coupled voltage terms.  The result is the regulator topology shown in Figure 2.

 Figure 2.  Decoupled PI Controllers for a PMSM

For AC Induction Motors, the correction becomes a little bit more sophisticated.  The differential equations defining AC induction motor operation are shown below:

             Equ. 4

        Equ. 5

where:     Rs = the stator resistance

               Ls = the stator inductance

               s = the leakage factor defined in Equ. 1

               D is the differential operator

               w = the electrical frequency

               Lm = the magnetizing inductance

               Lr = the rotor inductance

               lrd = the d-axis rotor flux

Similar to the situation with a PMSM machine, we see that there are other voltages besides Vd and Vq vying for control of id and iq respectively.  As a result, compensation voltages must be added to Vd and Vq to nullify these other voltage terms.  The compensation block used to provide correction voltages to the outputs of the id and iq regulators is shown in Figure 3.


Figure 3.  Compensation Block used for Axis Decoupling with ACIMs.

As an example of the effectiveness of this technique, consider the simulation results of figure 4 which show the id and iq waveforms for a 3 HP AC induction machine.  Without axis decoupling you can see how transient changes in iq current spill over into the d-axis.  This deviation from the commanded d-axis current will also cause an undesirable perturbation in the motor’s flux.  In the bottom graph we can see that the q-axis regulator is also ineffective at regulating iq during sudden changes in velocity.  But when the decoupling scheme of figure 3 is enabled, id and iq currents track their respective commanded values much more precisely.

Figure 4.  Id and Iq Waveforms with and without Axis Decoupling.

 A final thought about coupling compensation.  If you examine figures 2 and 3 you can see that what we are really doing is applying feed-forward signals to both the d and q regulator outputs.  The good news is that since this doesn’t add any poles to your closed-loop system, it is inherently stable.  But a word of caution…the feed-forward paths can inject very high frequencies from one axis into the other.  In some cases, this can excite your system with unwanted high frequency harmonics which can cause unwanted and unexpected behavior. This is especially true if you are operating the motor in field-weakened mode at high speeds.  Under these conditions you typically want to “handle with care”, or you can temporarily lose control of the motor. 

In my next and final blog entry on this topic, I would like to offer some concluding remarks regarding developing and debugging this PI tuning technique in a digital control system, as well as investigate the case where viscous damping is present.  In the meantime…

Keep Those Motors Spinning,


UPDATE  July 19th, 2013:  There have been several questions related to how I calculate the back-EMF constant (Ke) in my equations.  Several individuals have tried to use my spreadsheet with their motor designs, only to obtain incorrect results which can be traced back to how Ke is represented.

It turns out that the units for Ke in my spreadsheet are “volts (peak, line-to-neutral) per electrical radian per second”.  By representing Ke in SI units like this, its numerical value is equivalent to the motor flux (in Webers).  Unfortunately, very few (if any) motor manufacturers represent back-EMF this way.  This means that you must convert your datasheet value for Ke into the above units in order for the spreadsheet to yield correct results.  For example, Teknic Inc (as well as many other motor manufacturers) represents the back-EMF for their PMSM machines in volts (peak) per 1k RPM.  In just about every case, it is implied that this voltage is line-to-line since you usually can’t directly measure the line-to-neutral voltage.  To convert from these units to the SI units used in my spreadsheet, you must use the following multiplication factor:

 , where P is the number of rotor poles.

The following multiplication factors can be used to convert the back-EMF units most frequently found on motor data sheets into the SI units in my spreadsheet:

            To convert from                                                                    Multiply by

Volts(peak, line-to-line) per electrical Hz                                               

Volts(peak, line-to-line) per electrical radian/sec                                       

Volts(peak, line-to-line) per mechanical radian/sec                                   

Volts(peak, line-to-line) per kRPM                                                      

Volts(RMS, line-to-line) per electrical Hz                                               

Volts(RMS, line-to-line) per electrical radian/sec                                     

Volts(RMS, line-to-line) per mechanical radian/sec                               

Volts(RMS, line-to-line) per kRPM                                                    

  • Dear Dave,

    Thank you for the amazing PI series for Motor Control. I am a new comer to use Motorware to develop some prototypes of motor drives. I downed a presentation of yours named "InstaSPIN-FOC Secret Decoder Ring" in which you explained in detail about the internal structure of InstaSPIN based on Lab11. I found a strange thing that: why don't have the Compensation Block used for Feed-forward Decoupling in InstaSPIN of Motorware's code?

    Whether without his Feed-forward Decoupling Block, the quality of InstaSPIN would be reduce?

    Many thanks for your explanation!

  • Hi Dave

    For a PMSM, could you elaborate on the units for the parameters, used to do feedforward compensation for the cross coupling between the d- and q-axis:

    My assumptions would be:

    - R is the stator resistance (phase-neutral stator resistance)

    - Ls is the stator inductance (phase-neutral stator inductance)

    - Ke = the Back EMF constant (V_peak_phase2neutral/(el-rad/s))

    - w (omega) is the electrical frequency

    Bu I'm not sure about w (omega):

    From the units of the other parameters, and your choice of w (omega) I would assume:

    w = motor-speed * pole-pairs  => [el-rad/s])

    But since you use the word 'electric-frequency', I'm also considering, that w (omega) might be:

    w = motor-speed * pole-pairs / 2pi => [Hz]

    best regards, and many thanks for a fantastic blog!

    Anders Lange

  • Does the back emf "constant" relate to electrical rotor speed or mechanical rotor speed for ACIM?

  • Dave,

    Where did you get your decoupling equations/network for ACIM? I cannot find anything like it in the literature.


  • Hi Dave,

    Thank you very much for the amazing work you have done on this, I can't tell you how helpful all this has been.

    Question about conversion of the Speed constant to the Back EMF.  The datasheet I have on a motor gives both the speed and torque constant in rpm/V and Nm/A respectively.

    I assume multiply the speed constant by 1000,  invert it, then multiple by Sqrt(3)/(50*pi*P) to get Line to neutral V/radians per sec.

    My main question is the I've read that it is possible to convert the torque constant also into the back emf.  From what I've read it appears the units Nm/A are effectively V/rad/sec.  

    If there is indeed a relationship here, it would help me be a bit more confident that I was dong the former conversion correctly if the two came close to the same values.



  • For ACIM, why "equivalent resistance equal to the stator resistance PLUS the rotor resistance",  i really do not understand this, thanks for your explanation.