So, after lots of tuning (and only minor code changes) I would like to release what will hopefully be the final version for now. This version enables regen! It's still not as polished as I'd like, but it seems to work.
Attachments:
stm32-sine.bin - Version 5.26.X
tesla-sdu-performance-slipmin.json - this is the recommended configuration that I use in my car, high performance, fast throttle response, no regen
tesla-sdu-performance.json - my previous configuration, not as smooth as the version with slipmin
tesla-sdu-regen.json - less aggressive throttle slew, regen enabled
If you are testing this, be sure to apply the new parameters. I can't predict how it may behave with your existing parameters.
NOTE: The performance configuration is limited to 500A of DC current (idcmax=650) to protect my hybrid battery pack. If your batteries can take more, just increase idcmax. If they can take 700A+ then you probably don't need to use idcmax at all, and you will get a lot more out of the drive unit.
Parameters:
throtcur - set this to the number of amps (peak) per % throttle. SDU tested up to 8.0
rcurrent - set this to the number of amps (peak) per % regen. SDU uses 2.0
curkp - This is the gain for current correction in the positive direction. Default is 128 (note this value is scaled differently from the previous version)
ncurkp - This is the gain for current correction in the negative direction. Default is 128. Needs to be somewhat lower when regen is used enabled.
fslipmax - slip at 100% throttle. SDU uses 3.0
fslipmin - the slip at 0% throttle. Start at zero. There's probably no reason to raise it.
fslipweak - maximum value of slip for automatic field weakening SDU uses 4.0
rslipmin - slip at 0% regen, this should almost certainly not be changed from zero.
rslipmax - slip at 100% regen, this should be much lower than forward slip. SDU uses 0.5
regenrampstr - below this frequency, regen is reduced down. This has been tested all the way down to 1.0Hz but regen feels rather harsh at low speed, so higher values may be more pleasant.
Source code at
https://github.com/catphish/stm32-sine/tree/amp
Hopefully somebody other than me will be able to test this soon and comment on how it compares with the existing V/Hz firmware.
For anybody wanting to test, here are my recommended CAN exports for logging:
Code: Select all
can tx ilmax 1 0 32 32
can tx ilmaxtarget 1 32 32 32
can tx speed 2 0 32 32
can tx idc 2 32 32 32
can tx fslipspnt 3 0 32 32
can tx amp 3 32 32 32
can tx tmphs 20 0 32 32
can tx tmpm 20 32 32 32
I have attached a SavvyCAN graph definition for convenience (this assumes you have an ISA shunt for DC current).