Tuning the small drive unit with charts

Topics concerning the Tesla front and rear drive unit drop-in board
User avatar
catphish
Posts: 955
Joined: Fri Oct 08, 2021 11:02 pm
Location: Dorset, UK
Has thanked: 94 times
Been thanked: 179 times

Re: Tuning the small drive unit with charts

Post by catphish »

Peter wrote: Sat Aug 13, 2022 7:32 pm Hi Charlie. Sorry, I dont know the frequency on the version I have, factory default from Johannes I guess :-)
Only relevant data I can see is..
pwmfunc 0
pwmgain 100
pwmofs 0

I dont suppose your rapid temp rise could be due to coolant surging and starving the pump when accelerating ? Does the temp then fall back with a steady throttle ?
Do you have a laptop you can connect to the inverter wifi? If so, it would be great if you could download your full config from this URL: http://192.168.4.1/cmd?cmd=json hidden

If you can't do that, try typing this into the "send custom command" box, and scroll down to where it says "Messages:" and you should have a value like 1.00 or 0.00

Code: Select all

get pwmfrq
Alternatively, if you run this command, and then refresh, the PWM frequency option will be visible in the web interface. Be careful not to accidentally change it!

Code: Select all

flag pwmfrq !hidden
User avatar
catphish
Posts: 955
Joined: Fri Oct 08, 2021 11:02 pm
Location: Dorset, UK
Has thanked: 94 times
Been thanked: 179 times

Re: Tuning the small drive unit with charts

Post by catphish »

Peter wrote: Sat Aug 13, 2022 7:32 pm I dont suppose your rapid temp rise could be due to coolant surging and starving the pump when accelerating ? Does the temp then fall back with a steady throttle ?
That's a good thought but I'm quite confident it's not that. The rapid temperature rise is something that others have reported too. I'm also really very confident in my coolant header tank, it's completely full and the pump draws directly from the bottom of it.

I would also argue that even if there was no coolant at all, temperature shouldn't rise quite that fast. For a long time I was convinced that this rise was caused by an incorrect ratio between voltage (boost/fweak) and slip (fslipmax), but now, a slight increase in current is causing a huge increase in temperature, so I suspect that there's still a bigger problem.

One thing that definitely is possible is that I could have air trapped in the inverter. But again, I think this rate of temperature rise is unreasonable, even if it was momentarily not cooled at all.
User avatar
Peter
Posts: 310
Joined: Fri Dec 14, 2018 9:07 pm
Location: North West Lancs, UK
Been thanked: 8 times

Re: Tuning the small drive unit with charts

Post by Peter »

Thanks Charlie. I typed in the get pwmfrq command and sent it, it came back with 'nosey bastard' !!!

Not really... 0.00

:-)
User avatar
catphish
Posts: 955
Joined: Fri Oct 08, 2021 11:02 pm
Location: Dorset, UK
Has thanked: 94 times
Been thanked: 179 times

Re: Tuning the small drive unit with charts

Post by catphish »

Peter wrote: Sat Aug 13, 2022 8:01 pm Thanks Charlie. I typed in the get pwmfrq command and sent it, it came back with 'nosey bastard' !!!

Not really... 0.00
Thanks! As expected really, this is 17.6kHz, the same as mine. I guess I'll have to find answers elsewhere if I want more power!
User avatar
Peter
Posts: 310
Joined: Fri Dec 14, 2018 9:07 pm
Location: North West Lancs, UK
Been thanked: 8 times

Re: Tuning the small drive unit with charts

Post by Peter »

I have been looking at your parameters, I see you can set 'snshs', I dont have that facility, can I check that using a 'get' command ?
User avatar
catphish
Posts: 955
Joined: Fri Oct 08, 2021 11:02 pm
Location: Dorset, UK
Has thanked: 94 times
Been thanked: 179 times

Re: Tuning the small drive unit with charts

Post by catphish »

Peter wrote: Sat Aug 13, 2022 8:14 pm I have been looking at your parameters, I see you can set 'snshs', I dont have that facility, can I check that using a 'get' command ?
Yes probably. I actually don't know what the correct value is for the SDU, but I would assume the default from Johannes are correct.
User avatar
Peter
Posts: 310
Joined: Fri Dec 14, 2018 9:07 pm
Location: North West Lancs, UK
Been thanked: 8 times

Re: Tuning the small drive unit with charts

Post by Peter »

snshs = 2.00
User avatar
catphish
Posts: 955
Joined: Fri Oct 08, 2021 11:02 pm
Location: Dorset, UK
Has thanked: 94 times
Been thanked: 179 times

Re: Tuning the small drive unit with charts

Post by catphish »

Peter wrote: Sat Aug 13, 2022 8:34 pmsnshs = 2.00
Same as mine. Here's a graph of my tmphs over a 10 second period when I increase boost to 4000 and go full throttle.
hightemp.png
There's an interesting leg in the graph. It seems like there are 2 sensors at play here, one increases to 60C, then at that point, another sensor blows it out of the water rising rapidly to 90C.
User avatar
Peter
Posts: 310
Joined: Fri Dec 14, 2018 9:07 pm
Location: North West Lancs, UK
Been thanked: 8 times

Re: Tuning the small drive unit with charts

Post by Peter »

I will graph tmphs tomorrow and report back :-)
User avatar
Peter
Posts: 310
Joined: Fri Dec 14, 2018 9:07 pm
Location: North West Lancs, UK
Been thanked: 8 times

Re: Tuning the small drive unit with charts

Post by Peter »

Hi Charlie. Have you looked at the code which gives tmphs value ? I wonder if its different than mine ?
I am trying to get the code from github as a learning exercise next.
Will do the tmphs graph later this eve when traffic is light.
User avatar
Peter
Posts: 310
Joined: Fri Dec 14, 2018 9:07 pm
Location: North West Lancs, UK
Been thanked: 8 times

Re: Tuning the small drive unit with charts

Post by Peter »

Found my temperature code... I think !
Worth a look against the version you are using ?
https://github.com/jsphuebner/stm32-sin ... p_meas.cpp
User avatar
johu
Site Admin
Posts: 5769
Joined: Thu Nov 08, 2018 10:52 pm
Location: Kassel/Germany
Has thanked: 157 times
Been thanked: 1010 times
Contact:

Re: Tuning the small drive unit with charts

Post by johu »

When Tesla hardware is detected then snshs and snsm are ignored and the Tesla code is used.
There are 3 sources of heat sink temperatures and the maximum one is shown. From the looks of it these seem to be almost chip level temperatures, anyway the thermal mass of the heat exchanger is rather small so rapid rises are to be expected.

EDIT: concerning PWM frequency in one of the videos Damien has linked he explains why we chose it. The motor seems to have a very low inductance and low PWM frequency seemed to drive it into saturation with huge current spikes. Not scientifically worked out, just from looking at the current waveforms that look much "nicer" at 17.6 kHz
Support R/D and forum on Patreon: https://patreon.com/openinverter - Subscribe on odysee: https://odysee.com/@openinverter:9
User avatar
catphish
Posts: 955
Joined: Fri Oct 08, 2021 11:02 pm
Location: Dorset, UK
Has thanked: 94 times
Been thanked: 179 times

Re: Tuning the small drive unit with charts

Post by catphish »

johu wrote: Sun Aug 14, 2022 11:44 am When Tesla hardware is detected then snshs and snsm are ignored and the Tesla code is used.
There are 3 sources of heat sink temperatures and the maximum one is shown. From the looks of it these seem to be almost chip level temperatures, anyway the thermal mass of the heat exchanger is rather small so rapid rises are to be expected.

EDIT: concerning PWM frequency in one of the videos Damien has linked he explains why we chose it. The motor seems to have a very low inductance and low PWM frequency seemed to drive it into saturation with huge current spikes. Not scientifically worked out, just from looking at the current waveforms that look much "nicer" at 17.6 kHz
Thanks. I wasn't able to find the precise information from Damien about the 8.8kHz problem. I've started watching his videos but there's a lot to get through. In any case, I'm more than happy to believe that Damien knows what he's talking about here and I have no desire to blow up my inverter, so won't be making any changes there!

After spending some time reading through all the previous threads on the subject, I do wonder if my liquid cooling is just weaker than it could be. Other people with bigger pumps or lower coolant temperatures might just be able to push things harder than I can, and one person said they were able to improve this by improving their cooling loop.

I looked through the code and it seems that older versions don't interpret the SDU temperatures in the same way as the current version. Does this mean that Peter might be under-reading the temperature?

Specifically, i'm comparing the following:
https://github.com/jsphuebner/stm32-sin ... e.cpp#L284
https://github.com/jsphuebner/stm32-sin ... l.cpp#L419

EDIT: Actually these probably work the same, the way it's written just confused me a little!
User avatar
catphish
Posts: 955
Joined: Fri Oct 08, 2021 11:02 pm
Location: Dorset, UK
Has thanked: 94 times
Been thanked: 179 times

Re: Tuning the small drive unit with charts

Post by catphish »

I've been driving the car a bit today, and still totally happy to recommend the same configuration - run22-full.json attached earlier in the thread.This seems to work nicely even in this extremely hot (for Britain) weather, and with the latest firmware, avoiding all derates

While searching for information, I finally found Damien's recommended configuration. He runs at fslipmax=3.5 (the same as Peter) so I'd suggest that if the goal is pushing things harder than I have, this would be the way to go, whereas for minimal stress and maximum efficiency, fslipmax=3.0 seems optimal.

Thanks for the help everyone!
User avatar
catphish
Posts: 955
Joined: Fri Oct 08, 2021 11:02 pm
Location: Dorset, UK
Has thanked: 94 times
Been thanked: 179 times

Re: Tuning the small drive unit with charts

Post by catphish »

So today the ambient temperature here has fallen dramatically giving me a bit more headroom on the the temperature limit.

I thought I'd try increasing both fslipmax and boost together. This was a bit of a wild test, changing too many parameters at once to draw proper conclusions, but thought I'd post the resulting charts anyway.

fslipmax=3.5 (Damien and Peter like this value)
boost=3800 (I increased this linearly with fslipmax from my previous value of 3200)
fweak=250 (i didn't increase this, but I should have done to avoid smashing into the 500A DC limit)
0-60: 5.4s (Quite a bit faster, even with the derating)
idcmax: 550 (a value of 550 limits current aggressively to 500A)
AC current: 550A to 445A (this is quite a substantial increase on previous tests)
DC Current: 0 to 500A (it bounced off the 500A limiter before getting to 60mph, so way too high for my car)
Inverter temperature: 24C to 59C (a 35C rise is nowhere near as much as seen on previous tests with less AC current)

In any case, as per my original brief, I do not want to exceed 450A, so I will be dialing this back again, but it was an interesting test.

Current, speed and temp graphs for these settings below.
highcurrent.png
speedtemp.png
coleasterling
Posts: 20
Joined: Thu Mar 21, 2019 2:27 pm
Been thanked: 1 time

Re: Tuning the small drive unit with charts

Post by coleasterling »

This is some really great work, thank you!

Do you have and can you share any plots of RPM vs. battery and motor current?
User avatar
catphish
Posts: 955
Joined: Fri Oct 08, 2021 11:02 pm
Location: Dorset, UK
Has thanked: 94 times
Been thanked: 179 times

Re: Tuning the small drive unit with charts

Post by catphish »

coleasterling wrote: Wed Aug 17, 2022 9:38 pm This is some really great work, thank you!

Do you have and can you share any plots of RPM vs. battery and motor current?
I can't easily generate an XY scatter plot, but here's a plot with RPM x 10, battery current, and motor current.

This is using my conservative recommended settings (run22-full.json) at full throttle with a load of a 1100kg vehicle.
xy.png
User avatar
catphish
Posts: 955
Joined: Fri Oct 08, 2021 11:02 pm
Location: Dorset, UK
Has thanked: 94 times
Been thanked: 179 times

Re: Tuning the small drive unit with charts

Post by catphish »

After staring at these charts for a while, I realise I'm running into a fairly simple problem that's limiting my performance significantly. My desire not to exceed 450A means 2 things:

1) I limit AC current at 0RPM to 450A by setting boost. This works perfectly.
2) I limit DC current to 450A by setting fweak. This also works perfectly. By setting this to 250, we reach 450A at exactly the same time we reach 100% battery voltage, meaning this current is never exceeded. The fact that this occurs at 60mph is a handy bonus.

The resulting AC and DC current looks like this:
run21.png
In the top left we have 450A of AC current, and in the top-right we have 450A of DC current. The problem is that in the middle, there is a big area where both AC and DC current are less than 450A. For example at 80 seconds, the AC current has reduced to 400A, but the DC current has only risen to 290A. This means that for a significant portion of the acceleration, I am pushing only 90% of my target current.

When I tune more aggressively (boost=4000) to bring AC current up to 500A, the problem is even more apparent:
4000boost.png
Here we see that the initial 500A created by increasing the boost falls off quite quickly, with fweak being the factor that determines current for the majority of the acceleration curve. This means that most of the time, the currents are well below the 500A AC and 450A DC limits.

There would seem to be 2 solutions here:
1) Add a third point in the V/Hz cure. So in addition to 10% voltage at 0Hz and 100% voltage at 250Hz, I could add some more "boost" at 125Hz which would allow current to be increased at around 30mph without changing the 0mph peak and 60mph peak that are already tuned.
2) Reduce fweak. This would allow me to push a consistent 500A AC, yay, but would cause me to hit the DC current limiter. I had hoped to avoid the limiters (derates) because right now hitting this reduces the throttle to near enough zero, making for a fairly unpleasant driving experience, however with some improvement, we could make a smoother current limiter.

In a way, this brings me back to a more fundamental question. Should we be using an open loop, as I have favoured with this tuning, or a closed loop, where we measure current and try to maintain it within idcmax. From what I've experienced so far, the closed loop DC current control in openinverter isn't fast or accurate enough to provide a good driving experience, however I haven't yet spent enough time tuning idckp to see if this can be improved upon with configuration alone. I suspect that my suggested changes to the AC current measurement maths would help here, but that's beyond the scope of this thread.
User avatar
johu
Site Admin
Posts: 5769
Joined: Thu Nov 08, 2018 10:52 pm
Location: Kassel/Germany
Has thanked: 157 times
Been thanked: 1010 times
Contact:

Re: Tuning the small drive unit with charts

Post by johu »

Yes I see the problem with the idc limiter - idc is not being filtered at all. In FOC software there is idcflt which sets the filtering but I obviously forgot that in sine firmware. It is in pwmgeneration-sine.cpp : ProcessCurrents() if you feel like adding it in
Support R/D and forum on Patreon: https://patreon.com/openinverter - Subscribe on odysee: https://odysee.com/@openinverter:9
arber333
Posts: 3261
Joined: Mon Dec 24, 2018 1:37 pm
Location: Slovenia
Has thanked: 80 times
Been thanked: 232 times
Contact:

Re: Tuning the small drive unit with charts

Post by arber333 »

I remember there was another loop in sine code put there to limit current and voltage drop at the top of RPM.
If you would use that and set higher slip and boost for better start you could set fweak limit to lower the power at higher RPM. Bring constant power to desired speed.

Or was that piece of code changed in last sine versions?
User avatar
catphish
Posts: 955
Joined: Fri Oct 08, 2021 11:02 pm
Location: Dorset, UK
Has thanked: 94 times
Been thanked: 179 times

Re: Tuning the small drive unit with charts

Post by catphish »

arber333 wrote: Sun Aug 21, 2022 8:10 pm I remember there was another loop in sine code put there to limit current and voltage drop at the top of RPM.
If you would use that and set higher slip and boost for better start you could set fweak limit to lower the power at higher RPM. Bring constant power to desired speed.

Or was that piece of code changed in last sine versions?
It sounds like you're referring to idcmax. This parameter limits DC current to a specified value. This would be ideal and would allow me to lower fweak to achieve consistent AC current. Unfortunately it doesn't work very smoothly. It results in the throttle oscillating wildly when the current limit is reached.
User avatar
Peter
Posts: 310
Joined: Fri Dec 14, 2018 9:07 pm
Location: North West Lancs, UK
Been thanked: 8 times

Re: Tuning the small drive unit with charts

Post by Peter »

How difficult would it be to implement a PID algorithm to stop wild oscillation ?
User avatar
catphish
Posts: 955
Joined: Fri Oct 08, 2021 11:02 pm
Location: Dorset, UK
Has thanked: 94 times
Been thanked: 179 times

Re: Tuning the small drive unit with charts

Post by catphish »

Peter wrote: Sun Aug 21, 2022 9:45 pm How difficult would it be to implement a PID algorithm to stop wild oscillation ?
Johannes mentioned above that he thinks the work has already been done but not integrated into the "sine" version, so this might be an easy fix.
User avatar
johu
Site Admin
Posts: 5769
Joined: Thu Nov 08, 2018 10:52 pm
Location: Kassel/Germany
Has thanked: 157 times
Been thanked: 1010 times
Contact:

Re: Tuning the small drive unit with charts

Post by johu »

Peter wrote: Sun Aug 21, 2022 9:45 pm How difficult would it be to implement a PID algorithm to stop wild oscillation ?
PID doesn't magically stop oscillation ;) What is implemented is the P-part of PID. What is lacking is some low pass filtering to dampen oscillation
Support R/D and forum on Patreon: https://patreon.com/openinverter - Subscribe on odysee: https://odysee.com/@openinverter:9
arber333
Posts: 3261
Joined: Mon Dec 24, 2018 1:37 pm
Location: Slovenia
Has thanked: 80 times
Been thanked: 232 times
Contact:

Re: Tuning the small drive unit with charts

Post by arber333 »

johu wrote: Mon Aug 22, 2022 7:59 am PID doesn't magically stop oscillation ;) What is implemented is the P-part of PID. What is lacking is some low pass filtering to dampen oscillation
I noticed while in higher gear 3rd and 4th vehicle mass works in a way of low pas filtering, so any oscillations are wasted on the mass.
But in case of 2nd gear twitches are way more pronounced and any play in gearing will cause resonance and can brake clutches. This is really noticable in transmissions, but for SDU and LDU i would not exclude it, since small play at such low gearing (practicaly 2nd gear) can cause resonance in low RPM. I think the problem is not so much resonance but ability to reduce slip at low RPM when slip to RPM difference is small.
Maybe what we would need is feedback for slip reduction inversly proportional to the motor RPM to suppress oscillation.

How to detect oscillations? Hm... additional RPM sensor on the output shaft would be welcome. Then OI could detect stuttering on the output shaft and reduce slip...
Any inputs left free for single sided input via optical sensor and spoked wheel on the output shaft? We could use the Z axis signal since ACIM do not use this channel from inverter...
Post Reply