Page 5 of 30

Re: VW Touran powered by Nissan Leaf

Posted: Tue May 28, 2019 1:14 pm
by nailgg
Inside the CalcRms() method:

Code: Select all

bool signChanged = ((illast <= 0 && il > 0) || (illast > 0 && il <= 0)) && samples > 10;
Changing the number of ignored samples "samples > 10" to "samples > 20" or more could help at low frequencies. Maybe a simple ramp function to the number of ignored samples with up/down saturation points could partially fix the issue?

Example pseudo code that ignores 50 samples at 10Hz and below, and ignores 10 samples at 50Hz and above. Frequency vs. ignored samples between 10Hz and 50Hz are kind of linear. (not tested)

Code: Select all

s32fp ignoreSamples = MIN(MAX(60 - FP_TOINT(Param::Get(Param::fstat)), 10), 50);
EdgeType edge = CalcRms(il1, Param::Get(Param::il1), currentMax[0], rms, samples[0], il1PrevRms, ignoreSamples);

static bool CalcRms(s32fp il, s32fp illast, s32fp& max, s32fp& rms, int& samples, s32fp prevRms, uint8_t ignoredSamples)
{
   const s32fp oneOverSqrt2 = FP_FROMFLT(0.707106781187);
   bool signChanged = ((illast <= 0 && il > 0) || (illast > 0 && il <= 0)) && samples > ignoredSamples;
   ...
With 50 ignored samples the current will update much slower at low frequencies, but "slow" is definitely better than "incorrect" :)

Re: VW Touran powered by Nissan Leaf

Posted: Tue May 28, 2019 6:45 pm
by johu
Yes, thats a good idea. Will test later.

Now, here some pictures of my cooling system tubing in Touran.

Re: VW Touran powered by Nissan Leaf

Posted: Wed May 29, 2019 7:47 pm
by johu
nailgg wrote: Tue May 28, 2019 1:14 pm With 50 ignored samples the current will update much slower at low frequencies, but "slow" is definitely better than "incorrect" :)
Yes, that works! I have pushed it to github. Basically I also take PWM frequency into account.
I tested in Polo again.
It reliably detects motoring down to 0 speed. Only regen is sometimes detected as motoring at very low speed and very low regen setting. But it's not a problem. So in the firmware I pushed along with potnom you also command a current limit of potnom*iacmax. I even tried controlling only with current regulator, i.e. not passing through potnom at all. Even that works, but not so well at low loads and speeds. I should mention I do this in the 10ms loop, so moving it to 1ms should yield a more usable response time.

I'm currently feeling a bit sick, so hopefully I'm better tomorrow and can test in Touran.

Re: VW Touran powered by Nissan Leaf

Posted: Wed May 29, 2019 9:17 pm
by nailgg
johu wrote: Wed May 29, 2019 7:47 pm
nailgg wrote: Tue May 28, 2019 1:14 pm With 50 ignored samples the current will update much slower at low frequencies, but "slow" is definitely better than "incorrect" :)
Yes, that works! I have pushed it to github. Basically I also take PWM frequency into account.
I tested in Polo again.
It reliably detects motoring down to 0 speed. Only regen is sometimes detected as motoring at very low speed and very low regen setting. But it's not a problem. So in the firmware I pushed along with potnom you also command a current limit of potnom*iacmax. I even tried controlling only with current regulator, i.e. not passing through potnom at all. Even that works, but not so well at low loads and speeds. I should mention I do this in the 10ms loop, so moving it to 1ms should yield a more usable response time.

I'm currently feeling a bit sick, so hopefully I'm better tomorrow and can test in Touran.
Glad it worked :) Yes 10ms sounds too much for current regulation, 1ms loop would handle it better. Hope it doesn't consume too much cpu at 1ms.

Just noticed this on Github, isn't it a "division by zero" at zero frequency if I'm not overlooking something :shock:

Code: Select all

int minSamples = pwmfrq / (4 * FP_TOINT(frq));

Re: VW Touran powered by Nissan Leaf

Posted: Thu May 30, 2019 6:53 pm
by johu
Oh, thats right. Will fix it.
Theres still a lot of head room for adding calculations, especially in the "slow" tasks. The most time consuming is the PWM service routine, especially at 18kHz. And that currently uses about 45%.
edit: unfortunately I had to stay in bed today, so no more tests. Will have some results tomorrow.

Re: VW Touran powered by Nissan Leaf

Posted: Fri May 31, 2019 1:39 pm
by johu
So, moved current limiter to 1ms task but it's still not a very convincing approach. It does work but is wobbly. On Touran it doesn't really work as desired at all.

I will try using FOC now, see here: viewtopic.php?f=7&t=153

Re: VW Touran powered by Nissan Leaf

Posted: Mon Jun 03, 2019 8:37 pm
by johu
Did some miscellaneous stuff today. Programmed the instrument cluster to ignore the oil sensor: -1 beep and warning message. Reset the service internal: -1 beep. Reset DTCs of airbag controller: -1 beep. End result: All messages gone, all beeps gone, all but one warnings lights gone :D

Most control units complain about missing communication to ECU but don't generate any beeps or warning lights. Except the ABS controller seems to have a more intimate relationship with the ECU and is responsible for the remaining error light. I tried playing back running ECU CAN messages but Ms. ABS wasn't happy. Anyone know how to fix this? Otherwise TÜV will not be happy either.

Re: VW Touran powered by Nissan Leaf

Posted: Fri Jul 05, 2019 9:23 pm
by johu
Just back from Sweden.

I visited "langoo" in his home town Varberg to look at his beautiful Beetle conversion and have a chat. Among that he demonstrated a Nissan Leaf Gen 2 drive train with the original controller. I was in for a surprise: I could clearly here the switching frequency. And it certainly did not sound like 17.6kHz or anything close. We connected a multimeter to the DC bus in frequency mode and it showed spot on 5kHz. So running the poor thing at almost 4x that might be part of the problem.

Unfortunately that means having to take out the control car (and change ONE resistor), which means draining the cooling system again. Good thing I only filled it with pure water.

Re: VW Touran powered by Nissan Leaf

Posted: Sat Jul 06, 2019 3:43 am
by celeron55
You shouldn't have to worry about the cooling so much. I've driven city trips with my gen2 leaf powered Toyota Previa with an emptied out cooling system with no alarming temperatures when testing stuff. The original software makes it amazingly efficient.

Re: VW Touran powered by Nissan Leaf

Posted: Sun Jul 07, 2019 9:19 am
by arber333
celeron55 wrote: Sat Jul 06, 2019 3:43 am You shouldn't have to worry about the cooling so much. I've driven city trips with my gen2 leaf powered Toyota Previa with an emptied out cooling system with no alarming temperatures when testing stuff. The original software makes it amazingly efficient.
Also here we kept Leaf motor very cool with FOC code. Its just that inverter has to be cooled since it has so low thermal mass.
I set PWM at 6kHz and its not like it is whining all the time. Only when we load it on takeoff or when we get to field weakening. Then it sounds like you would pull a cat by the tail :). But that is only beyond 4kRPM at 200Vdc with 360Vdc you should get up to 8000RPM without whining.

Re: VW Touran powered by Nissan Leaf

Posted: Sun Jul 07, 2019 7:05 pm
by johu
@Arber: Is that with Lebowski?
@celeron: you must be the guy who decoded the Leaf protocol, good to have you here :)

So I tried with 8.8kHz today. Not really a heureka moment yet... But at least the inverter now stays cool through all the punishment. Will write more in the FOC thread

I did use inverter charging to top up the batteries a bit, so at least that works :)

Re: VW Touran powered by Nissan Leaf

Posted: Mon Jul 08, 2019 11:09 am
by arber333
johu wrote: Sun Jul 07, 2019 7:05 pm @Arber: Is that with Lebowski?
@celeron: you must be the guy who decoded the Leaf protocol, good to have you here :)

So I tried with 8.8kHz today. Not really a heureka moment yet... But at least the inverter now stays cool through all the punishment. Will write more in the FOC thread

I did use inverter charging to top up the batteries a bit, so at least that works :)
Yes Lebowski code works in my friends car. I am working hard to get my car moving this month. I need to get front battery box support made and fit DCDC, inverter and charger into the car. Vacuum and steering pumps are there. Everything is under control.... well everything except A/C signal and RPM.

Re: VW Touran powered by Nissan Leaf

Posted: Wed Jul 10, 2019 8:17 pm
by johu
Test drive!

Re: VW Touran powered by Nissan Leaf

Posted: Thu Jul 11, 2019 6:57 am
by Jack Bauer
Fantastic progress:)

Re: VW Touran powered by Nissan Leaf

Posted: Thu Jul 11, 2019 4:52 pm
by Kevin Sharpe
Very cool :)

Are you going to list the video so that we can share the good news on social media?

Re: VW Touran powered by Nissan Leaf

Posted: Sat Jul 13, 2019 9:12 pm
by langoo
Great to see some more progress :)

Re: VW Touran powered by Nissan Leaf

Posted: Sat Jul 13, 2019 9:45 pm
by johu
More progress here: viewtopic.php?f=7&t=153

Video is now listed, thanks for sharing :)

Re: VW Touran powered by Nissan Leaf

Posted: Sun Jul 14, 2019 2:20 pm
by johu
Special release for forum:

Re: VW Touran powered by Nissan Leaf

Posted: Sun Jul 14, 2019 5:04 pm
by doobedoobedo
Awesome. Great that you got to the bottom of it :).

Re: VW Touran powered by Nissan Leaf

Posted: Mon Jul 15, 2019 5:08 am
by arber333
Hi, finally you have it! Congrats.

I had to scrap one complete set of nice boards when i found out i had mixed up phase 1 and 3 with Lebowski setup :(.
I am now really careful with prototypes and also design a sort of jumper leads inline with resolver and current sensor leads. Just in case i need to swap them.
Also i found the limits of the main chip transistor output and i use signal inverter that can provide more power to drive original optos.

Re: VW Touran powered by Nissan Leaf

Posted: Mon Jul 15, 2019 7:56 am
by johu
Thanks :)

Luckily I can just swap things back in software. I've introduced a "pinswap" parameter so that it works on different boards.

Re: VW Touran powered by Nissan Leaf

Posted: Mon Jul 15, 2019 9:45 am
by Craig Miles
Ok, so apologies for posting totally off topic, but HOW is it possible to start a new post on this forum?

I registered a few months back, but cannot for the life of me see any way to do anything, except respond to existing posts.

Therefore have not written anything before.

Thanks for any help.


Craig

Re: VW Touran powered by Nissan Leaf

Posted: Mon Jul 15, 2019 10:30 am
by Bigpie
Navigate to the sub forum you want to post in and hit 'New Topic'
Image
Have you not got this button available?

Re: VW Touran powered by Nissan Leaf

Posted: Thu Jul 25, 2019 11:38 am
by johu
Back on topic :D

Re: VW Touran powered by Nissan Leaf

Posted: Thu Jul 25, 2019 5:44 pm
by Jack Bauer
That is great work Johannes. Well done.

Also spotted a nice white E36 at 3.40 :)