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:

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:

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:

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(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 • thanks for this very thorough and interesting article on <a href="http://www.proplasint.com">speed controllers</a>

• Thank you for your excellent explanation of PI controller in motor drive system. One question, it seems you didn't mention decoupling function of the current PI control, as I know, with the motor speed rising, back-EMF part will put a heavy burden to the controller. How do you think about that?  With decoupling condition & without decoupling condition. Thanks.

• Hi Peijun.  Sorry for the delayed response.  For some reason, I didn't see your comment until just now.

I am not sure I completely understand your comment, and what you mean by "decoupling function".  Your comment about rising speed and the resulting back-EMF is correct.  You will notice that my decoupling block in Figure 2 takes this into consideration.  Of course, if the back-EMF becomes too high, it will limit your ability to develop any current, regardless of the decoupling network.  In this case, you must rely on Field Weakening to reduce the back-EMF constant, thereby reducing the back-EMF voltage.

-Dave

• Hi,

I have a question regarding the PI Controllers. I would suppose the decoupling network relies on the absolute inductances of the motor and the calculation of the PI controller coefficients is based on the differential inductances of the motor? Correct me if I'm wrong.

Regards,

• Hi Stanko,

I'm not sure what you mean by "absolute" vs. "differential" inductances.  However, the values used for the PI tuning and the decoupling network are the same for a given motor type.  Throughout this blog series, I have attempted to be consistent with the meaning of the resistances and inductances.  For example, the equations for PI tuning and the decoupling network both use Ls.  This is the same Ls that is listed on the datasheet for most motors.

Regards,

Dave

• Hi Dave,

Thanks for the answer. By differential I mean "small signal" Inductance. When the core of the rotor gets saturated the inductance changes with the current applied to the motor. Now I am duing a control for a motor, which is driven also in the saturated states, this means that the inductance is not the same throughout the whole operating range.

Due to the fact, that the PI controller controls out the "small signal" behaviour of the machine I use the differential inductance of the motor - Inductance only valid when I whish to change the current operating point of the machine by a small value (which is actually the PI-controller doing). For the decoupling network I use however the absolute inductance (the value of the inductance at the operating point times the speed). I hope now its more clear what I mean, its however difficult without any graphics to explain it.

Regards,

Stanko

• Hi Stanko,

Thanks for the explanation.  I now understand your question.

My analysis is based on a linear parametric assumption of the motor model.  If nonlinearity is introduced due to magnetic saturation of the motor iron, then as you said, the inductance will change as a function of current.  For the PI coefficients in the current loop, you should use the instantaneous value of inductance found by the slope of the hysteresis curve at that local operating point.  In other words, the small-signal equivalent value of the inductance.  The way we handle this at TI for motors that exhibit strong saturation effects is to develop a Look-Up Table of inductance as a function of current for that particular motor which can be used to "modulate" the PI coefficients in real time.

My first thought is that the compensation network coefficients should be dynamically changed the same way that the PI coefficients are.  However, I must admit that I don't have any experience with this.  I will have to think about this some more...

-Dave

• Hello Dave,

I really appreciate what you done here - sharing your knowledge and experience related on motor controls.

I started to make the FOC algorithm by myself (using C++ language) in order to spin a behavioral model of PMSM and I followed your steps posted in these series. I written all formulas and try to catch the way for stability analysis (something I made at faculty) but also I found your Excel sheet with the formulas for PI coefficients. For my system this Excel is working with a single adjust for Ki coeff. for Speed loop: I have to decrease a lot the value of Ki because the response time of the system is too large (perhaps because also I have the other model blocks, apart from control & motor). But, still, I have a question: I observed thet the expressions for Ka, Kc and Kd are different from the Excel, more exactly seems to be the formulas from you blog but multiplied with squared time constant of Speed filter.

Is this true ? Why did you done this?

- the original formulas (from your blog) are not working in my case, but from Excel yes !

Aly

• Hello Aly,

The definitions for Kc and Kd are defined in part IV of my series.  I checked them against the spreadsheet linked in this blog and could not find the discrepancy that you are referring to.  I wonder...could you possibly be confusing the pole of the speed filter (1/time constant) with the damping factor?  The damping factor is indeed squared in the calculation of Ki, but the speed filter pole is not.

-Dave

• Hello Dave,

Indeed I made a mistake in my analysis with formulas from spreadsheet.

There is the w=2*pi*f (f = freq. of pole) and not the time constant  of this Low Pass Filter.

Aly

• Hi Dave,

Thank you for this educational and informative blog.

I have been trying to design a controller for a PMSM motor using the decoupling scheme like you explained, and while simulating the motor at speeds close to its field weakening point, I observe that the system gets unstable.

So could you please elaborate on the "handle with care " remark you made? As in what measures can be taken to hold the stability of the decoupling network at high speeds?

Thanks and regards.

• Hello Aswin,

My comment about "handle with care" was specifically related to the field weakened region of operation.  During this time, the normal back-EMF of the motor exceeds the power supply voltage.  The only reason it doesn't appear is because it is being actively suppressed by the injection of negative d-axis current.  However, if something happens to disrupt this suppression, the back-EMF will immediately appear on the motor terminals and possibly blow up your drive.  I have also observed that quick changes in speed or torque in the field weakened region can cause instability, and you should change these parameters slowly during field weakened operation.

From your comments, it sounds like your instability issues are associated specifically with the decoupling network itself.  I would try some tests to verify whether this is the case or not.  Do you have the same problems when you remove the feed-forward signals?  Also, try lowering the feed-forward gains for both d and q axes and see if it has an effect on stability.  Finally, are you doing a digital simulation?  The equations I provide assume that sampling frequency is essentially infinite.  But in a real implementation of such a system, the sampling frequency itself may be affecting the stability.  You can determine whether this is the case by increasing the sampling frequency in your simulation and see if the problem goes away.

Best Regards,

Dave

• Thank you for this series. It has been extremely helpful. I am having doubts about this Ke conversion equation though. I have a 400W PMSM motor that gives a Ke of 31.63 V/krpm. If I use the above conversion, Sqrt(3)/(50*pi*P) I get around .0436 webber.  I thought the conversion would be something like (Ke/1000)*(30/pi) to convert to V/rad/s.  This latter conversion gives me about .302 webber.  Which value seems right for a 400W PMSM?  Also how is the conversion you have above determined.  I found it strange to be using the number of poles since I am looking for a constant that relates to the whole motor and not just one magnet.  Any insights or references would be greatly appreciated.