Why and how is PWM implemented in Field Oriented Control (FOC) ? - Page 1
Forum section: electronics / beginners

author: cadena
author_rank: Contributor
timestamp: April 06, 2020, 07:18:43 pm
content: Hi everyone,I am trying to understand and implement FOC algorithm in MATLAB for a PMSM. I understand we are converting the 3 phase stator currents into 2 time-invariant stator currents: (direct and quadrature currents or Id and Iq, respectively). But I do not unsderstand how PWM is applied here since PWM can only alternate between High and Low currents but I do not understand why this is required or how it will help in torque control since. I thought the PI controllers adjusted Id and Iq to be the same as the reference currents and then inverse Park transform and inverse Clarke transfroms would be applied to get 3 phase voltages. PWM shouldn't be used since we are feeding 3 phase voltages into the stator. So what is the function of PWM here ? What does it do ? Please your help would be really appreciated since I am struggling a lot with this. Thank you in advance.Also could someone explain me how the PI controllers manage to convert currents into voltages to be fed into the inverse Park transform ?Also why is Space Vector PWM (SVPWM) employed ? what makes is that good ? (Could you also point me to a source (preferably academic) which explains SVPWM?

author: Kilrah
author_rank: Unknown
timestamp: April 06, 2020, 07:29:28 pm
content: Take a step back from the equations and look at the motor... there's only one way to vary the current in the windings, applying more or less voltage to them. From a DC source PWM is the only practical way to do that.SPWM becasue the movement of the magnets in front of the rotor poles inherently creates a sine wave, and to maximize efficiency, reduce noise (both acoustic and in terms of torque ripple) you want your field to match that and be sinusoidal too.

author: cadena
author_rank: Contributor
timestamp: April 06, 2020, 09:06:02 pm
content: Thanks for your reply @Kilrah but how is the motor going to use DC if FOC is about sinusoidal currents ?

author: Yansi
author_rank: Super Contributor
timestamp: April 06, 2020, 09:22:16 pm
content: Quote from: Kilrah on April 06, 2020, 07:29:28 pmNot true. PWM is not the only modulation. How about PDM? (pulse density modulation). Or algorithms similar to DTC with hysteretic controllers.Not sure what SPWM is, but the likely term to look for is SVPWM. Space Vector ... modulation. You need sinusoid, but also a unity modulation index to achieve tha maximum AC voltage per DC input.Also there are other modulation schemes, SVPWM is not the only one, although often the used one. Also search for "60-degree PWM", third harmonic injection, etc... But you need to be aware of the limitation of your hardwer the algorithm will be implemented on. Some power stages will not work with 60°PWM, so SVPWM is used,.

author: WattsThat
author_rank: Frequent Contributor
timestamp: April 06, 2020, 09:40:03 pm
content: The stator of a motor is an inductor. As with all inductors, you cannot change the current in an inductor instantaneously, the inductance limits the rate of change.Applying dc pulses via PWM into the stator results in the integration of those pulses over time resulting in current that ends up looking something like a sine wave. Not a perfect sine wave but close enough to make the motor happy. Of it course runs hotter due to the resulting PWM distortion than on a perfect sine wave source but this is taken into account in the ratings by the motor manufacturer.

author: Kilrah
author_rank: Unknown
timestamp: April 06, 2020, 10:22:12 pm
content: Quote from: cadena on April 06, 2020, 09:06:02 pmThe whole point of the FOC controller is to turn DC that it's powered with into sinusoidal AC fed to the motor.Quote from: Yansi on April 06, 2020, 09:22:16 pmSPWM just means a high frequency PWM that is modulated in order to result in a sinusoidal wave.Take a standard BLDC ESC, it will switch the H bridge with a square wave each time a magnet passes a pole. An FOC ESC will switch the H-bridge much faster and with the duty cycle controlled by a sinusoidal function.Motor inductance serves as a nice filter to smooth it.

author: max_torque
author_rank: Super Contributor
timestamp: April 07, 2020, 12:28:41 pm
content: Quote from: cadena on April 06, 2020, 07:18:43 pmSimple answer, they don't!FoC measures (or estimates) stator phase current in the fixed 3 axis non rotating reference frame of the stator, then converts those 3 currents into a rotor synchronous rotating 2 axis/current frame of reference, ie with those currents split into the quadrature axes d & q.It then looks at what the target currents are for those axes, and calculates the errors from those target. If that error is positive, ie there is insufficient current, then (assuming we are motoring, not absorbing for a moment) a greater voltage is applied (higher PWM duty cycle) to the stator, to attempt to drive a greater current through it as demanded.With a very basic PI controller without any feed forward, that control loop is simply an iterative one, where hopefully, each time around, the current error gets smaller and smaller. Because the FoC calcs are usually done synchronously with the basic PWM frequency these days (thanks to nice fast uC's doing the calcs!), even a basic PI controller without feed forwards can work well on a high inductance machine operating at reasonably sensible supply voltage.For a high performance machine, and particularly one that needs to operate significantly into the d axis (field weakening or high reluctance torque machine, ie IPM) then better operation is obtained by calculating some basic FF terms, which can be done asyncronously (ie not in time with the fundamental PWM) but that massively help to get the PI axes current controller well towards it's eventual set point (allowing a faster response with lower error, but also a more stable current control loop because you can avoid high gain in the PI controller)So in effect, the PI current controller controls current, but does so by applying voltages, which the phase inductance (primarily) then results in a current we want!

author: Siwastaja
author_rank: Super Contributor
timestamp: April 07, 2020, 01:19:12 pm
content: Hi,A motor winding is a large inductance. When you apply a voltage to an inductance, current starts changing, but with a big inductance, this happens slowly. When the PWM phase output is high, the current through the winding is rising. When the PWM phase output is low, the current through the winding is falling. The idea is to keep the PWM frequency high enough (and the motor inductance high enough as well) so that the current ripple during each cycle is a small percentage of the average current flowing. For example, you could think that at the beginning of the cycle, 10A is running through the winding. Turn the high-side switch on - current starts rising. It might be at 11A at the maximum point, when the high-side switch turns off, low-side switch turns on, and the current starts falling, until it's 10A again. Now, you can just simply describe this situation that "the current is 10.5A", abstacting the whole PWM modulation thing away. This is the average current you measure, and the current you feedback using the (well-tuned, fast) PI loops, or alternatively, using hysteretic means, but AFAIK the hysteretic way of "directly" controlling the currents wouldn't be called FOC.