# How does an inverter control current?

I understand how to control voltage. If I have a buck converter supplied with DC voltage ($$\V_{DC}\$$), I can command the output voltage ($$\V_{out}\$$) directly via the duty ratio ($$\D = V_{out}/V_{DC}\$$).

For example, If $$\V_{DC}\$$ = 12 V, and I want $$\V_{out}\$$ = 5 V, then I set $$\D=\$$ 5/12 ~ 0.42 in my microcontroller. I can vary $$\D\$$ as my desired $$\V_{out}\$$ changes at any instant in time.

If I had a bridge, I could also vary the polarity between +/- $$\V_{DC}\$$ and thereby command a sinusoidal $$\v(t) = V_{DC}\sin(\omega t + \phi)\$$.

How do you command a current?

I understand how sinusoidally commanding current unlocks a whole host of things like field-oriented control for motors. But how do you command current? Isn't current a response to voltage? Can you command a current without knowing the load's impedance (I = V/R)?

• There is a feedback loop which senses current and adjusts duty cycle "D" to achieve the desired current. It might very well be a PID loop. So the output will still be a sinusoidal voltage but a control loop is used to scale the amplitude of the sinusoid. Oct 26 at 16:46
• Ok, so in the case of FOC, you're arguing there is another PID loop within the current controller block that adjusts D based on sensed and desired i_d, i_q ? Oct 26 at 17:31
• More precisely it is a PI and not a PID. And yes, the block with the name "Current Controller" has two of them, one for d-axis and one for q-axis. Their outputs adjust the PWM. Oct 26 at 20:22
• @MarkoBuršič I see, so the current controller uses feedback and desired id, iq to command vd vq (duty ratio for vd, vq?). The dq/abc block transforms this to abc for the PWM generator which actually generates the waveform. correct? Oct 27 at 18:59
• abc/dq transforms three phases to DC like machine, you do control like DC machine, then dq/abc transforms back to three phase. PWM controls the voltage. So you have a closed loop - you do control current by controlling voltage by having a current feedback. Oct 28 at 5:49

I am not an expert on implementing FOC. But I have some experience working with motor controllers. I believe the current control is always implemented using a PI controller (like a PID controller but the 'D' part of "PID" is not used).

I also worked with a guy who was implementing PI current control firmware using phase advance as opposed to FOC. Based on empirical testing he created lookup tables and interpolation schemes to decide how much phase advance should be used for given operating conditions. We talked about it a lot, so I know he was using a PI loop.

Tuning the PI loop is an important part of achieving good performance, especially if you have a highly dynamic load.

If you are using a sinusoidal output voltage (regardless of whether you use FOC or not) you can think of the PI loop as operating on the amplitude factor of the sinusoid rather than the duty cycle directly (if that makes sense).

• Your first comment to my question answered it really. Thanks for the extra info! Oct 28 at 16:10

But how do you command current?

You command current by monitoring the current and adjusting the voltage to produce the current you want to command.

Isn't current a response to voltage?

For some loads it is, for others it isn't. It depends on the type and nature of the load.

Can you command a current without knowing the load's impedance (I = V/R)?

Yes. You measure the current and adjust the voltage to obtain the current you need. In so doing, you can determine the load's impedance, but generally you don't care.

But none of this applies to typical inverters. They don't command any particular current and instead are specified to produce a particular voltage. This is the same way that typical home electricity works -- the source is specified to provide a particular voltage and makes no attempt to control the current that flows through the load other than to shut it off if it exceeds safety limits.

• You're supporting what @mkeith argued in that there is a feedback loop on current based on measured and desired current. Voltage is the controller's output (input to plant) and the plant can be an arbitrary black box (eg, 3-phase motor). Correct? Oct 26 at 19:43
• I should clarify that by inverter I mean the box between a battery and motor in a modern EV. Oct 26 at 19:44

The two go hand-in-hand. If, on average, you're providing slightly more current than the load sinks, the voltage will be increasing as you charge the output capacitance, since that's where the excess current will flow. And, conversely, if on average you provide too little current, the output capacitance will discharge and the voltage will be decreasing.

The current and voltage control loops have quite different transfer functions and require different approaches to stabilize (compensate) them. A treasure trove of design guides and analyses of SMPS control loop design and compensation can be found on Christophe Basso's web page.

It is not unusual to provide both current ant voltage loops in tandem if the application requirements could make use of that. When implementing the loops in software, as long as you have both current and voltage feedback, you can experiment with essentially all available control schemes, as long as you get comfortable transcribing the s-domain transfer functions into the Z-domain. The latter can be transcribed directly into C code :)

• Ok, so the controller implicitly controls current via voltage (duty ratio), maybe via another PID loop. Correct? Oct 26 at 19:51
• @techSultan You can run it in pure voltage control, pure current control, or both at the same time. Most controllers have more poles and/or zeroes in the feedback than a simple PID circuit that only got up to one of each. Assuming a PID controller will often yield much lower performance than what the circuit could otherwise do, since you'll end up running it at lower gain and bandwidth. The choice of a control loop requires some circuit analysis. I don't design those every day so can't tell you off hand which approach takes what. I end up doing it from first principles every couple of years :) Oct 26 at 20:45
• wait but that's what I don't understand. How do you do "pure" current control ? Oct 27 at 18:56