Changing FOC Switching frequency

chuttney1 Power, torque, rpm are all linked via simple formulae. https://www.engineeringtoolbox.com/angular-velocity-acceleration-power-torque-d_1397.html

Basically, at a given input power and rpm, there is a maximum torque that’s produced. Multiply that torque by the efficiency (0.85 is 85%) to get the actual torque output. There are calculators out there that’ll let you avoid the math and unit conversions. https://www.engineeringtoolbox.com/angular-velocity-acceleration-power-torque-d_1397.html

To me, i prefer to think about power in, efficiency and rpm as input variables, and torque being a result of the efficiency.

Pedrodemio, i did start with BLDC, and in my first couple tests, it seemed a couple percent lower efficiency, so i kinda stopped testing. I’ll go back and see what else shows up. Easy to change and test.

1 Like

Think i managed to include a dodgey run in the last set, which offset the conclusions. turnigy%20multistar%20100kv_2 Omitting the first run, which didn’t have a strong curve, and seemingly lots of noise (like run5?), it seems that the same trend of 20khz being the preferred frequency has re-emerged.

Not sure why that first run was so bad. Will think on that one.

Runs are numbered chronologically but the legend lists them in order of frequency. Switched battery half way through, but i don’t think that had a strong effect. Ideally i’d have a fatty lab power supply, but then i’d have to have a scheme for dumping the generated energy too.

1 Like

You need your own thread for this setup man! It is good stuff.

1 Like

This is very interesting. I have not done any extensive testing like you, however I changed the FOC frequency from 20 to 30kHz in an attempt to reduce noise even further and for the first time my FocBoxes exceeded 80C and started to cutout. This is the first time this has happened as it is usually my motors that overheat first. I think I will go back to 20kHz.

Why would the switching frequency effect the motor? I can imagine inefficient torque pulses at a really low frequency But at the high frequency wouldn’t it smooth the current flow and hit a point of ideal efficiency based on the inductance and capacitance at that point when the current in the primary waveform is smooth as can be? Looking around the web I don’t see an explanation for motor heating due to increased frequency but much to the contrary

If you are replying to me, what I wrote is that it is the vescs that overheat when increasing the switching temperature. Motors overheating is irrelevant to switching frequency in my case.

1 Like

Hummie, i think you’re right in that i don’t think there is a reason a higher switching frequency would negatively affect a motor. In my tests the motor and controller are considered together, so it could be that while the motor is marginally more efficient, the controller get less efficient by a greater amount. I guess there could be some negative capacitive and/or inductive effects, but i’m not sure i’m smart enough to figure that out :-/

Also, in my offhand remark about the motor temperature (if that’s what you’re referring to), the “measurement” was an approximate and subjective one. “I’ve run it a few times back to back, and the same test twice in a row gives slightly different but consistent results, i wonder why, oh, the temperature is definitely higher, let’s let it cool off a bit and do another” type deal. No real science/measurement there (as if there was rigor elsewhere).

I’m absolutely no EE, but the interwebs says this about MOSFET switching losses “The other source of power loss is through switching losses. As the MOSFET switches on and off, its intrinsic parasitic capacitance stores and then dissipates energy during each switching transition. The losses are proportional to the switching frequency and the values of the parasitic capacitances. As the physical size of the MOSFET increases, its capacitance also increases; so, increasing MOSFET size also increases switching loss.”

https://www.eetimes.com/document.asp?doc_id=1278970

Thanks. I’m believing the heat is only increasing with increased frequency in the esc at the fets

Especially with the low kv we use maybe we could go down to a lower frequency for ultimate eff. I’m more and more wanting an oscilloscope to see the different harmonics.

Yeah, i’ve got a USB scope that i’m thinking i might hook up to this and see what the waveforms look like.

In my testing, i was surprised that i got a lower efficiency with a lower switching frequency. I’d heard that higher frequencies would be less efficient, so that wasn’t surprising, so i’m a little confused about the lower frequencies. My guess is it has to do with the PID constants. I haven’t changed those from their defaults, and they are likely set up to work well with the 20khz default. The curves i’m getting are much more erratic under 20khz, so perhaps it’s hunting a bit more? I haven’t investigated PID changes yet, but that might be another interesting thing to chase after (along with the scope reading)

1 Like

the control loop of the FOC algorithm runs at 0.5*pwm frequency. The current controllers is designed to have a 1000 us (1kHz) time constant by default . As a rule of thumb, it’s wise to run your controller at about 10x the controller frequency to avoid aliasing effects so its possible tuning down the current controller time constant at lower pwm frequency could help.

Lower pwm frequency results in lower switching losses on the vesc but can generate more losses in the windings due to higher ripple current in the motor (more losses during current spikes with i^2)

4 Likes

Fascinating! I haven’t poked around too much in the VESC firmware, other than the confirm serial communication format, and research on an issue with braking duty cycle below 5%.

In my config, i’ve got a vesc 6, and sample V0 and V7 is enabled, which according to the tooltip means it’s actually sampling at full 1* pwm freq.

Any thoughts or can anyone point me towards a vesc pid tuning guide?

As to the current spike losses in the motor, that’s an interesting point, but i’d imagine that there is still an optimal balance between motor losses and vesc losses, and it’s unlikely to be 20khz. There will be a superposition of the two efficiencies that is lowest, what frequency is that at? Surely it’ll change per motor, and perhaps with different models of vesc. Why do both the motors i’ve investigated frequency on (on the same controller, but i’ve got two, and perhaps that’s the next test, run a known motor on the 4.12 controller and see what the differences are) have max efficiency at 20khz?

2 Likes

Generally, the waveform for a bldc motor is a step-like pattern in the shape of a sine wave unless you are talking about the one where you can see the switching of the mosfet on and off.

You’re right about the simulated sine wave, i think, but that’s the ideal waveform, what does it really look like? How mangled are the leading and trailing edges of the steps from capacitance? What about voltage spikes from changing/collapsing magnetic fields? What about frequencies too high for wires that are too big (lots of skin effect?). We could theorize about all that, but just putting a scope on it and seeing for real (understanding that the scope will also load and change the circuit very slightly) would be illuminating.

This shows wire diameter and frequency and skin effect https://chemandy.com/calculators/skin-effect-calculator.htm

BLDC:

^in bldc/block commutation, the switching frequency affects the spacing of the tiny current spikes, which averaged gives the motor current value (2 phases are always powered while one has avg ~0a current), but the switching frequency does not affect the overall commutation timing or avg current value…

as the switching frequency gets lower, this plot will look more “toothy” & “jagged…” & as the frequency gets higher, the plot will look smoother and less jagged.

FOC will look more like this with a sinusoidal waveform, with all 3 phases energized simultaneously (except for the 0a crossings):

4 Likes

For skin effect, https://chemandy.com/calculators/skin-effect-calculator.htm

I get ~500uM which is 0.5mm at 0.02Mhz = 20khz.

Appreciable number, but i’m not sure if there will be a real effect.

1 Like

@Petertaylor i wonder whether each separate motor’s differing inductance value influences the “most efficient” switching frequency?

I absolutely would have thought so, but the tests seem to prove otherwise. That’s the bit i’m wondering if the community can speak to. The two motors here are very similar however, so perhaps it’s just blind luck that they are at the 20khz mark.

@Petertaylor I suspect, for example, a motor with very low inductance would require a much higher switching frequency to prevent the current plot from becoming too “jagged…”