Page 6 of 8
Re: Current control of induction motors
Posted: Sat Jan 28, 2023 7:37 pm
by Pete9008
Sorry I meant the svpwm table approach.
Re: Current control of induction motors
Posted: Sat Jan 28, 2023 7:50 pm
by johu
Please don't change to lookup table

the Sin() and Cos() function need it to be plain sine and they are used by FOC
Re: Current control of induction motors
Posted: Sat Jan 28, 2023 7:54 pm
by catphish
Pete9008 wrote: ↑Sat Jan 28, 2023 7:37 pm
Sorry I meant the svpwm table approach.
Oh, I see. I think there are a LOT of ways to approach this. Ultimately though, in most cases the output is just an angle and a magnitude. As long as that's the case, the angle can be looked up in a precomputed table and multiplied by the amplitude. I'm not sure if the FOC implementation does something different though.
Re: Current control of induction motors
Posted: Sat Jan 28, 2023 7:55 pm
by catphish
johu wrote: ↑Sat Jan 28, 2023 7:50 pm
Please don't change to lookup table

the Sin() and Cos() function need it to be plain sine and they are used by FOC
Don't worry, I think it's better to use plain sine wave output at lower amplitudes anyway

Re: Current control of induction motors
Posted: Sun Jan 29, 2023 8:34 am
by Pete9008
catphish wrote: ↑Sat Jan 28, 2023 5:54 pm
I'll test tomorrow without the space vector offset. I'm also wondering if the space vector is a red herring and we jump it because it happens to have a similar shape. Another potential cause is deadtime.
As far as I know, shifting all three waveforms by the same amount is the (or at least one of several) correct ways to do SVPWM, however I wonder if rather than doing it all the time, we'd be better off outputting plain sine waves until we actually run out of voltage, and only shift the waveforms at that point. This would have the benefit of using more of the DC bus voltage, hence giving better PWM resolution, and less impact of deadtime.
I think you could be right with your suspicions about deadtime. At small pulsewidths deadtime will have a much larger impact and will cause the current to be slow to move away from 0 which is pretty much what you are seeing. Will be interesting to see your results with svpwm disabled but my guess is that the distortion around the zero crossing will still be there.
Edit - actually is this right with centre aligned PWM??
Re: Current control of induction motors
Posted: Sun Jan 29, 2023 8:37 am
by Pete9008
Pete9008 wrote: ↑Sat Jan 28, 2023 6:48 pm
A SVPWM wouldn't work for the FOC build as it creates the values directly from Ud and Uq via the inverse transforms.
Also just noticed that there was a word missing in yesterday's post, it was supposed to read "A SVPWM table wouldn't work for FOC". Sorry for the confusion!
Re: Current control of induction motors
Posted: Sun Jan 29, 2023 9:16 am
by johu
Pete9008 wrote: ↑Sun Jan 29, 2023 8:34 am
I think you could be right with your suspicions about deadtime. At small pulsewidths deadtime will have a much larger impact and will cause the current to be slow to move away from 0 which is pretty much what you are seeing. Will be interesting to see your results with svpwm disabled but my guess is that the distortion around the zero crossing will still be there.
Edit - actually is this right with centre aligned PWM??
It's never right as 0 voltage is commanded with roughly 50/50. Small pulse width only occur at high amplitudes.
Re: Current control of induction motors
Posted: Sun Jan 29, 2023 9:24 am
by Pete9008
Not sure, the way deadtime is calculated and the offsets it produces can have some unexpected side effects in full bridges and three phase systems. Be interesting to see the results

Re: Current control of induction motors
Posted: Sun Jan 29, 2023 9:51 am
by catphish
Pete9008 wrote: ↑Sun Jan 29, 2023 8:34 am
I think you could be right with your suspicions about deadtime. At small pulsewidths deadtime will have a much larger impact and will cause the current to be slow to move away from 0 which is pretty much what you are seeing. Will be interesting to see your results with svpwm disabled but my guess is that the distortion around the zero crossing will still be there.
Edit - actually is this right with centre aligned PWM??
johu wrote: ↑Sun Jan 29, 2023 9:16 am
It's never right as 0 voltage is commanded with roughly 50/50. Small pulse width only occur at high amplitudes.
Johannes is correct. At zero sine wave amplitude, the inverter output is 50/50, so i think the deadtime should be negligible.
I redid the test with SVPWM offset disabled. It's still broken. I can't comprehend what's going on here

There seem to be multiple oddities to see here, but the standout problem is the odd current shape.
NB. This is running at 0Hz shaft speed plus 0.5Hz slip. The period is about 2.5 seconds. The top values are the actual hardware PWM outputs (shifted down, originaly centered at +1024 to fit nicely on the chart)
Re: Current control of induction motors
Posted: Sun Jan 29, 2023 9:56 am
by Pete9008
What's the voltage scale there, any idea what the actual pwm register values are? Very suspicious about the zero crossing, if its not deadtime then quantisation?
Edit - I think the zero crossing distortion on one phase may be responsible for the peak dip on another.
Edit2 - pretty good sin waves though
Edit3! - do the SDU gate drivers have any deadtime functionality built into them?
Edit4!! - do you have any way of plotting the phase to phase voltage values rather than the phase values. I think that small waveform distortions may be leading to phase to phase errors that would become apparent if they are plotted.
Re: Current control of induction motors
Posted: Sun Jan 29, 2023 10:21 am
by catphish
Pete9008 wrote: ↑Sun Jan 29, 2023 9:56 am
What's the voltage scale there, any idea what the actual pwm register values are? Very suspicious about the zero crossing, if its not deadtime then quantisation?
Edit - I think the zero crossing distortion on one phase may be responsible for the peak dip on another.
Edit2 - pretty good sin waves though
Edit3! - do the SDU gate drivers have any deadtime functionality built into them?
1) The PWM scale is 0..2047, centered at 1024. Attached is a chart with the raw values (I just removed the offset).
2) The sine wave looks pretty good, though I need to work out why it occasionally appears to skip backwards a step.
3) I don't know if there's any hardware deadtime. I assume (hope) the value of deadtime=63 came from somewhere. I'm scared to attempt to reduce it, as my only power source is my battery.
The PWM resolution isn't great, but it really should be good enough to create something that looks like a sine wave.
Edit: looking closely at this waveform it looks like its missing its peaks. Perhaps the resolution isn't good enough?
Re: Current control of induction motors
Posted: Sun Jan 29, 2023 10:28 am
by Pete9008
Did you notice edit4 above? It's relevant to your comment on the peak too.
Re deadtime I was wondering whether Tesla the hardware might have a deadtime function built in too, if it was larger than the firmware deadtime it could produce some interesting effects (unlikely but worth a thought).
Re: Current control of induction motors
Posted: Sun Jan 29, 2023 10:33 am
by catphish
Pete9008 wrote: ↑Sun Jan 29, 2023 10:28 am
Did you notice edit4 above? It's relevant to your comment on the peak too.
I'll see if I can export the data into a spreadsheet and do a calculation of the phase to phase voltage.
Re: Current control of induction motors
Posted: Sun Jan 29, 2023 10:38 am
by johu
That is surprising but also good to know it's not a flaw in the svpwm implementation. I wonder what values actually make it to the IGBTs? It wouldn't be short pulse suppression as you're far away from extreme duty cycles.
Actually, what are we looking at? Is that from a Prius inverter or Tesla?
Re: Current control of induction motors
Posted: Sun Jan 29, 2023 10:45 am
by catphish
catphish wrote: ↑Sun Jan 29, 2023 10:33 am
I'll see if I can export the data into a spreadsheet and do a calculation of the phase to phase voltage.
I've plotted the phase-to-phase voltages (based on the PWM output values). It looks clean.
Re: Current control of induction motors
Posted: Sun Jan 29, 2023 10:50 am
by catphish
johu wrote: ↑Sun Jan 29, 2023 10:38 am
That is surprising but also good to know it's not a flaw in the svpwm implementation. I wonder what values actually make it to the IGBTs? It wouldn't be short pulse suppression as you're far away from extreme duty cycles.
Actually, what are we looking at? Is that from a Prius inverter or Tesla?
This is the tesla, and with my new code. I definitely don't think this is going anywhere near the deadtime or short pulse suppression. My guess would be that the PWM value vs phase to phase voltage relationship isn't linear in the way we assume?
Re: Current control of induction motors
Posted: Sun Jan 29, 2023 12:01 pm
by Pete9008
I'm pretty much out of ideas then
Only other question is does it still do it with the rotor locked, or is this with the rotor locked?
Edit - I know it's an induction motor but could it be cogging? See
https://www.electrical4u.com/craw ... 0cogging.
Re: Current control of induction motors
Posted: Sun Jan 29, 2023 1:03 pm
by catphish
Pete9008 wrote: ↑Sun Jan 29, 2023 12:01 pm
I'm pretty much out of ideas then
Only other question is does it still do it with the rotor locked, or is this with the rotor locked?
Edit - I know it's an induction motor but could it be cogging? See
https://www.electrical4u.com/craw ... 0cogging.
This is with the rotor locked (specifically, this is in my car, with the brake on, and i'm deliberately pushing slightly too little current to create substantial torque).
It's definitely possible that the stator windings are creating this harmonic.
Re: Current control of induction motors
Posted: Sun Jan 29, 2023 2:02 pm
by Pete9008
Bit heavy on the math but worth a look on the harmonics (5th looks a possibility)?
https://www.analog.com/media/en/tra ... ter3.pdf
Re: Current control of induction motors
Posted: Sun Jan 29, 2023 3:44 pm
by catphish
So it turns out the relationship between output voltage and rotor speed is almost completely linear (who knew?!).
This gives me a crazy idea. What if instead of measuring current, I just set the output voltage according to measured rotor frequency?
Yes, I know... but I'm tempted to try something a little different - using the V/Hz curve, but with fully dynamic slip. With the correct motor parameters, I wonder if I can disconnect both voltage and current from the throttle, and instead allow current to fluctuate dynamically while controlling only slip.
I have no idea what the results will be, but I sure want to find out. I guess this is just what you get if you (carefully) set fslipmin=0 and ampmin=100 on the V/Hz firmware, and I'm intrigued.
It's worth noting that I've now proven we can effectively do cycle by cycle current limiting, so after getting fed up with current sensors, I think I will play with the V/Hz firmware for a while and see if I can bring across what I've learned here.
Edit: 30 seconds of testing has put an end to this idea. The idea above doesn't work at all. I'll have another stab at tacking the current sensing issue.
Re: Current control of induction motors
Posted: Sun Jan 29, 2023 5:35 pm
by catphish
Just to note, the behaviour is exactly the same in the V/f firmware. It obviously doesn't matter as much here, but interesting that it still doesn't look like a clean sine wave.
Re: Current control of induction motors
Posted: Sun Jan 29, 2023 5:51 pm
by catphish
Just did a bit of reading. It seems very likely that this waveform is the result of oversaturating the stator magnetic field at this very low frequency. It may be that the magnetizing current needs to vary with frequency (or more likely, I'm just not setting it correctly).
This paper has some similar looking waveforms.
https://www.sciencedirect.com/science/a ... 2316300177
I feel like it would be easier if I had a hard figure for the correct magnetizing current for an SDU, even just a ballpark.
Edit: I'll go read my book again!
Re: Current control of induction motors
Posted: Sun Jan 29, 2023 7:31 pm
by Pete9008
I think the voltage and speed will only be proportional for a fixed rotor current, the moment the rotor current changes so does the flux linkage and so the back emf.
Find it a little hard to believe that you are saturating the stator at those currents, I could easily believe it is saturating the rotor though (that would also give very odd current waveforms).
I like all the approaches that you are are trying here but still think you need a better handle on the rotor current/flux to make them work well.
Re: Current control of induction motors
Posted: Sun Jan 29, 2023 9:28 pm
by catphish
Pete9008 wrote: ↑Sun Jan 29, 2023 7:31 pm
I think the voltage and speed will only be proportional for a fixed rotor current, the moment the rotor current changes so does the flux linkage and so the back emf.
That certainly seems to be the case. Using raw V/Hz directly doesn't work correctly at all. I'll ignore that idea and get back to learning about current and flux linkage.
Pete9008 wrote: ↑Sun Jan 29, 2023 7:31 pm
Find it a little hard to believe that you are saturating the stator at those currents, I could easily believe it is saturating the rotor though (that would also give very odd current waveforms).
I like all the approaches that you are are trying here but still think you need a better handle on the rotor current/flux to make them work well.
I believe you're correct on both counts. I've certainly been flailing a little while learning and experimenting with simple approaches that
almost work.
Here is what I do know so far:
* Current delivered to the stator windings is divided into an active portion that delivers torque and a reactive portion.
* By adjusting slip, we can change the proportion of D and Q currents.
* At full torque in steady state (at least as far as I've pushed it), each winding carries 500A RMS, the optimal slip is around 3Hz, and the power factor is around 0.6.
* Something is interfering with my current, creating unusual waveforms.
What I absolutely
don't understand right now is how and when the rotor is magnetized, and how that interacts with the stator field and current.
I think next I should capture compare the current waveforms with a few different frequencies and currents with the rotor locked. I should also try to find some information about how the rotor gets magnetized.
Thank you for the pointers so far. I realise you understand the physics better than I do!
Re: Current control of induction motors
Posted: Sun Jan 29, 2023 9:56 pm
by catphish
Here's a dump of the current state of affairs (the good and bad).
Also a savvycan dump of a couple of miles of driving with gentle and hard acceleration if anyone else can be bothered to dig into the data.
The main outstanding problem seems to be the voltage/current oscillations during very slow/gentle driving (ie small slip, usually low rotor speed), possibly caused by unusual current waveforms. Otherwise response is excellent.