Page 1 of 6

Tuning the small drive unit with charts

Posted: Wed Jul 27, 2022 10:11 am
by catphish
I wanted to start a thread to document my efforts to tune the SDU using log data and charts. To begin with, I will focus purely on full-throttle 0-60. The goal is to have flat line of motor current (i1) and DC current rising consistently to a safe maximum (ideally around 450A). My first run uses the following paramaters (I believe these are the only paramaters that are relevant at full throttle:

Code: Select all

Voltage: 300V
Boost: 2700
Fweak: 250
fslipmax: 4
fslipconstmax: 4
idcmax: 500
Using SavvyCAN, I can chart the AC and DC current, along with potnom.
0-60.png
It can be seen from the first run that the ratio between boost and fweak isn't quite perfect, as the AC current reduces as the car accelerated. This isn't significant enough to be a problem, and may in fact be desirable (see below).

More dramatically, it can also be seen that aggressive derating is occurring when the DC current reaches 400A.

By comparing the Idc (from the inverter) with the current data from my ISA shunt, we can see that the DC current is being slightly overestimated by the inverter, hence why the 500A limit is being triggered (just a little) prematurely.
current-comparison.png
With this in mind, I need to decide whether to increase the DC current limit, or try to reduce current. While the first option may be acceptable and within the specs of the motor, I would prefer to save my batteries, and instead reduce current.

I will experiment with doing so, either by adjusting fweak to reduce voltage at higher speeds, or by adjusting fslipmax, which should reduce current at all speeds. It is difficult to know which of these to adjust as both will likely have an impact.

When I've finished, I hope this will produce both a parameter set, and some documentation that will be useful for others. I will try to document on the wiki how to use SavvyCAN to log this data and create these charts. I personally find this approach more appealing than tuning by feel.

Re: Tuning the small drive unit with charts

Posted: Wed Jul 27, 2022 12:46 pm
by EV_Builder
Did you plot voltage at the inverter once? To see if the current setup can deliver the amps for the asked duration?
Batteries might be capable but then there is temperature and busbar connections and other connections etc. etc.

Re: Tuning the small drive unit with charts

Posted: Wed Jul 27, 2022 1:01 pm
by catphish
EV_Builder wrote: Wed Jul 27, 2022 12:46 pm Did you plot voltage at the inverter once? To see if the current setup can deliver the amps for the asked duration?
Batteries might be capable but then there is temperature and busbar connections and other connections etc. etc.
That's a good point, I'll add voltage to my logger so I can observe the level of voltage drop.

Re: Tuning the small drive unit with charts

Posted: Wed Jul 27, 2022 2:48 pm
by catphish
Run 2 - I've changed the parameters as follows:

Voltage: 300V
Boost: 2600
Fweak: 280
fslipmax: 4
fslipconstmax: 4
idcmax: 500
run2.png
The decrease in boost from 2700 to 2600 causes a reduction in the starting current from reduces the initial current at 0RPM from 480A to to 420A. At the same time, the increase in fweak reduces the current at 60MPH from approx 450A to approx 390A. The overall result is that the DC current limit is still reached, but only barely, and much later.

This also increases the 0-60 time from 7.5s to 8.5s.

Re: Tuning the small drive unit with charts

Posted: Wed Jul 27, 2022 3:10 pm
by catphish
This configuration is very pleasant to drive, but at this point, I should explore three important questions:

1) What impact will changing fslipmax have on current, and what impact will it have on performance? Setting this correctly should improve efficiency. The published parameters for the SDU use a fslipmax of 6, compared to only 4 in my config, so I'll compare this change.
2) What should I do about that last bit of derating. It seems like it should be avoided, so I can either increase idcmax a little to allow the peak, or increase fweak just a little more to ensure we don't hit that 400A. My batteries are rated for 361A peak, so it makes sense (for my setup specifically) to further reduce the current.
3) The most important question - should I now increase boost? With the present configuration, current is more or less consistent across the rev range which was my original goal, but at low revs I have lots of unused power available! I increasing boost will give more torque at the start and doesn't stress the batteries, but I need to to be careful not to rip my driveshafts apart testing!

For now, I will increase boost just a little (back to 2700) which I know is safe, and increase fweak a tiny bit more again to ensure I avoid pulling 400A from the battery. I will drive for a while with this level of performance until I am 100% happy with the mechanical situation, and will then push the boost harder.

I will look at documenting this tuning process in case anyone else wants to achieve the same thing. I imagine most people will probably want to push it much harder then me!

Re: Tuning the small drive unit with charts

Posted: Thu Jul 28, 2022 8:17 pm
by Peter
Hi Charlie. You could reduce throttle ramp to get off the line quicker.
You will also notice a small 'boost' when your batteries are fully charged too, I charge to 330v.

Re: Tuning the small drive unit with charts

Posted: Sat Jul 30, 2022 2:50 pm
by catphish
So today I looked at changes to fslipmax. As expected, higher values of fslipmax cause an increase in current, however I quickly ran into a problem - inverter overheating.

Pushing 400A-450A through the motor phases, the inverter heated from 27C up to 70C in 7.5 seconds. I don't think this is a problem with my cooling because it cools down again just as quickly as soon as I let go of the throttle.

I increased fslipmax from 4 to 5. The the result was an increase in current to 520A (nice and consistent / expected result). Unfortunately, the inverter temperature then rose from 27C to 87C(!!) in 4.7 seconds(!!).
overheat.png
With this in mind, it seems that I can't realistically push more than 400A through the motor. I will instead look for ways I can get more torque in exchange for that current. I will continue to experiment with slip values, but at much lower voltages, to see if I can find some efficiency gains without melting my IGBTs.

Re: Tuning the small drive unit with charts

Posted: Sat Jul 30, 2022 2:58 pm
by catphish
With that said... the official specs of the SDU claim 220kW at 360V. That means it should be able to handle 600A for 10 seconds. I suspect this current would be possible if we were switching more efficiently - I'm scared to reduce the switching frequency though.

I'd be happy with 2-thirds of the official peak torque at 400A, but I don't feel like I'm achieving that yet.

Re: Tuning the small drive unit with charts

Posted: Sat Jul 30, 2022 4:01 pm
by catphish
Comparing higher higher slip vs higher voltage, there is a clear winner:

slip=4
boost=2650
fweak=290
Time: 9.1
AC: 420A to 370A
DC: 0 to 350A
Temp: 70C
Regen: -42A to -33A

vs

slip=3
boost=2800
fweak=280
Time: 8.8 seconds
AC: 392A to 326A
DC: 0 to 323A
Temp: 55.6C
Regen: -40A to -36A
d16.png
It would be worth doing more runs to be sure, but it seems clear that a slip value of 4 is too high to be optimal for my SDU, and 3 is better, performing a faster acceleration with less power.

With a slip value of 6, I could barely do anything without smashing into derating limits.

I think that's enough test driving for today, but I will come back to this. What's particularly interesting here is that I'm *nowhere near* the performance that others like Peter are achieving with the SDU, but when I try more extreme value like slip=6 that others are using, I immediately draw way too much current. However with this more optimal slip value, I think I have the ability to push the voltage quite a bit higher.

Re: Tuning the small drive unit with charts

Posted: Sat Jul 30, 2022 4:41 pm
by Peter
Hi Charlie. May I suggest using an older version of the software to compare against your results. Could be an interesting comparison.

Re: Tuning the small drive unit with charts

Posted: Sat Jul 30, 2022 4:54 pm
by EV_Builder
My gut feeling is that you need more voltage. Also I wondered if you checked voltage sag during those runs. Also I feel we need more resolution on that slip number. Maybe the optimum is 3.2 or 3.4 etc..

Re: Tuning the small drive unit with charts

Posted: Sat Jul 30, 2022 5:11 pm
by catphish
EV_Builder wrote: Sat Jul 30, 2022 4:54 pm My gut feeling is that you need more voltage. Also I wondered if you checked voltage sag during those runs. Also I feel we need more resolution on that slip number. Maybe the optimum is 3.2 or 3.4 etc..
I agree on both counts. Now that I've reduced the current by reducing slip, I have some margin to push up the voltage. I'll increase it to push the current back up to 400A, but hopefully it'll be making more efficient use of that 400A,with more torque than before.

The optimal value will be somewhere between 2 and 4, I really need to find a flat empty space to do more runs at increments of 0.2Hz and compare each one.

With regard to voltage sag, here's a graph matching the previous run. The voltage drops from 308.5V down to 294.7V as the current rises to 350A. It's not negligable, but it's also "factored in" to my process, as I'm adjusting fweak to give consistent AC current anyway.
voltage.png

Re: Tuning the small drive unit with charts

Posted: Sat Jul 30, 2022 5:26 pm
by johu
Regarding temperature I've had the discussion with a German builder. He'd smash into the 85°C limit regularly. Given the fast temperature rise suggests that we're not seeing heat sink temperature but chip temperature. These can be a good deal hotter than heat sink temps and he raised tmphsmax to 110°

On my Nissan Leaf setup I disabled derating all together but that's because Nissan has good hardware protection which I doubt Tesla has. Nissan also measure chip temperature and it rises within seconds on hard acceleration above 100°C

Re: Tuning the small drive unit with charts

Posted: Sat Jul 30, 2022 6:20 pm
by EV_Builder
Ok that's like 4.5% on the limit i would say.
13.8VDC @ 350Amps = 40mOhm is that your battery resistance?
Do you have a measurement near the battery? Same Sag?
104kW of DC input Power.

Re: Tuning the small drive unit with charts

Posted: Sat Jul 30, 2022 6:35 pm
by catphish
EV_Builder wrote: Sat Jul 30, 2022 6:20 pm Ok that's like 4.5% on the limit i would say.
13.8VDC @ 350Amps = 40mOhm is that your battery resistance?
Do you have a measurement near the battery? Same Sag?
104kW of DC input Power.
That voltage data was from my BMS, so that's the voltage directly at the cells. I don't log the voltage reported by the SDU.

That certainly implies that the pack resistance is 40mOhm.

The pack is rated for 120kW for 15 seconds, which is why I'm choosing to limit myself to 400A DC at full power.

Note: in these tests, the the voltage is always being limited by the inverter, not the battery. My fweak setting of 290 means I won't send the full 310V until 69mph. If the voltage is too low (which I suspect it is), it's only because it's *set* too low.

What we're attempting to do here is to find the right balance between current caused by increasing fslipmax, and current caused by adjusting boost and fweak. If it's out of balance in either direction, the excess just gets wasted as heat somewhere in the system.

Re: Tuning the small drive unit with charts

Posted: Sat Jul 30, 2022 11:28 pm
by EV_Builder
Yupsz that's clear. I would make sure that the SDU sees same voltage as BMS not that there is more going on between the batteries and the inverter.

Re: Tuning the small drive unit with charts

Posted: Sun Jul 31, 2022 9:21 am
by catphish
A new day, a new test run. This time pushing the voltage a lot harder to make use of the new found efficiency:

pack voltage: 309V
fslipmax: 3
boost: 2900
fweak: 240
AC current: 438A - 358A
DC Current: 0A - 400A (hit limiter)
Temperature: 25C - 54C
0-60: 6.35s
run4.png
This run hit the DC current limiter, but definitely getting closer now.

One issue is that 3.0Hz was a totally arbitrary choice. I've proven that it's better than 4.0Hz, but it may still not be optimal. Unfortunately it's simply not practical to test every frequency.

Re: Tuning the small drive unit with charts

Posted: Sun Jul 31, 2022 10:39 am
by Peter
Hi Charlie. Just looked at the battery spec, pack current peak is 450A, 150A per string.

Re: Tuning the small drive unit with charts

Posted: Sun Jul 31, 2022 11:01 am
by catphish
Peter wrote: Sun Jul 31, 2022 10:39 am Hi Charlie. Just looked at the battery spec, pack current peak is 450A, 150A per string.
There are actually 2 numbers of interest in the battery specs:

Max current: 450A (150A per string, 5C)
Discharge power: 130kW for 15 seconds (at the original 360V this equates to 360A, 120A per string, 4C)

So it seems to me that LG are specifying a *peak* instantaneous discharge of 450A and a 15-second discharge of 360A). For that reason, I've arbitrarily set myself a limit of 400A.

I think I will now reduce my voltage just a little to stay below 400A at the top end. I'm quite happy with boost, but might set myself a slightly slower throttle ramp for smoother launch.

I know it would be nice to push for the sub-4-second launch, but I think I will put that on hold until I'm 100% happy with the mechanical aspects, particularly the driveshafts in my case,

Once those final adjustments, are made, I will re-tune the regen, probably for engine-braking simulation rather than single-pedal driving.

Re: Tuning the small drive unit with charts

Posted: Sun Jul 31, 2022 12:44 pm
by Peter
Are you considering the effect of slipstart too ?

Re: Tuning the small drive unit with charts

Posted: Sun Jul 31, 2022 1:44 pm
by catphish
Peter wrote: Sun Jul 31, 2022 12:44 pm Are you considering the effect of slipstart too ?
This testing is only at full throttle (every run is at full open throttle start to end) and slipstart has no effect at full throttle.

Once full throttle performance is acceptable (ie fast but efficient, and not hitting any derating limits), then I can make minor tweaks to things like fslipmin, slipstart, and ampmin which will improve comfort and feel.

With that said, as far as I can tell, my current settings for those things seem absolutely fine, and "normal" driving feels smooth and comfortable.

Re: Tuning the small drive unit with charts

Posted: Sun Jul 31, 2022 4:40 pm
by catphish
The final change is to set fweak to 260. This allows DC current to reach its peak (just a fraction below 400A) at a little over 60mph, and avoids any derating. This setting causes AC current to reduce as speed increases, which is not necessary to protect the motor or inverter, but keeps the total DC current below 400A to protect my batteries.

The boost value of 2900 is strong enough to feel responsive from standstill but limits the startup AC current to around 400A RMS, which prevents excessive heating of the inverter.

This configuration isn't winning any drag races, and doesn't represent the limits of the small drive unit, but takes my car to 60mph in around 7.2 seconds within my arbitrary limit of 400A and without any derating which I find feels very unpleasant while driving.

Anybody wanting to run this configuration with more powerful batteries could simply decrease fweak. A value of 240 shaves over half a second off the 0-60 time, and it could certainly go further than this if the DC current limit were increased accordingly.

Here's a graph of the run:
run5.png
Attached is a full copy of the parameters.

In the future it may be worth trying other values of slip such as 2.5 or 3.5 to see if any further gains can be made. The process is time consuming though because for each value of slip (fslipmax) to try, several runs are required to adjust boost and fweak accordingly to set peak AC and DC current to 400A before torque (ie 0-60 time) can be compared.

Re: Tuning the small drive unit with charts

Posted: Sun Jul 31, 2022 9:15 pm
by Peter
Hi Charlie. What method are you using to graph speed ?

Re: Tuning the small drive unit with charts

Posted: Sun Jul 31, 2022 9:19 pm
by catphish
Peter wrote: Sun Jul 31, 2022 9:15 pm Hi Charlie. What method are you using to graph speed ?
I'm multiplying the RPM reported by openinverter by a constant based on the gearing and wheel circumference.

Re: Tuning the small drive unit with charts

Posted: Sun Jul 31, 2022 9:26 pm
by catphish
Attached is the full parameter file. This includes a set of CAN exports. The following data is exported to the CAN bus every 10ms:

* i1rms (phase 1 RMS current)
* i2rms (phase 2 RMS current)
* speed (motor RPM)
* potnnom (the final throttle position after calculations and ramping, negative for regen positions)
* tmphs (inverter temperature)
* tmpm (motor temperature)

In addition, I get DC current from my ISAscale shunt. The DBC files (for use with SavvyCAN) to receive, decode and chart all this are also attached. The speed (mph) assumes my wheel size (808 rotations per mile).