[DRIVING] VW Touran powered by Nissan Leaf  [FINISHED]

Tell us about the project you do with the open inverter
Post Reply
nailgg
Posts: 119
Joined: Sat Dec 22, 2018 8:40 pm

Re: VW Touran powered by Nissan Leaf

Post 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" :)
User avatar
johu
Site Admin
Posts: 6227
Joined: Thu Nov 08, 2018 10:52 pm
Location: Kassel/Germany
Has thanked: 228 times
Been thanked: 1272 times
Contact:

Re: VW Touran powered by Nissan Leaf

Post by johu »

Yes, thats a good idea. Will test later.

Now, here some pictures of my cooling system tubing in Touran.
Attachments
IMG_20190528_203548.jpg
IMG_20190528_203445.jpg
Support R/D and forum on Patreon: https://patreon.com/openinverter - Subscribe on odysee: https://odysee.com/@openinverter:9
User avatar
johu
Site Admin
Posts: 6227
Joined: Thu Nov 08, 2018 10:52 pm
Location: Kassel/Germany
Has thanked: 228 times
Been thanked: 1272 times
Contact:

Re: VW Touran powered by Nissan Leaf

Post 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.
Support R/D and forum on Patreon: https://patreon.com/openinverter - Subscribe on odysee: https://odysee.com/@openinverter:9
nailgg
Posts: 119
Joined: Sat Dec 22, 2018 8:40 pm

Re: VW Touran powered by Nissan Leaf

Post 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));
User avatar
johu
Site Admin
Posts: 6227
Joined: Thu Nov 08, 2018 10:52 pm
Location: Kassel/Germany
Has thanked: 228 times
Been thanked: 1272 times
Contact:

Re: VW Touran powered by Nissan Leaf

Post 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.
Support R/D and forum on Patreon: https://patreon.com/openinverter - Subscribe on odysee: https://odysee.com/@openinverter:9
User avatar
johu
Site Admin
Posts: 6227
Joined: Thu Nov 08, 2018 10:52 pm
Location: Kassel/Germany
Has thanked: 228 times
Been thanked: 1272 times
Contact:

Re: VW Touran powered by Nissan Leaf

Post 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
Support R/D and forum on Patreon: https://patreon.com/openinverter - Subscribe on odysee: https://odysee.com/@openinverter:9
User avatar
johu
Site Admin
Posts: 6227
Joined: Thu Nov 08, 2018 10:52 pm
Location: Kassel/Germany
Has thanked: 228 times
Been thanked: 1272 times
Contact:

Re: VW Touran powered by Nissan Leaf

Post 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.
Support R/D and forum on Patreon: https://patreon.com/openinverter - Subscribe on odysee: https://odysee.com/@openinverter:9
User avatar
johu
Site Admin
Posts: 6227
Joined: Thu Nov 08, 2018 10:52 pm
Location: Kassel/Germany
Has thanked: 228 times
Been thanked: 1272 times
Contact:

Re: VW Touran powered by Nissan Leaf

Post 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.
Support R/D and forum on Patreon: https://patreon.com/openinverter - Subscribe on odysee: https://odysee.com/@openinverter:9
User avatar
celeron55
Posts: 800
Joined: Thu Jul 04, 2019 3:04 pm
Location: Finland
Has thanked: 37 times
Been thanked: 131 times
Contact:

Re: VW Touran powered by Nissan Leaf

Post 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.
arber333
Posts: 3403
Joined: Mon Dec 24, 2018 1:37 pm
Location: Slovenia
Has thanked: 96 times
Been thanked: 287 times
Contact:

Re: VW Touran powered by Nissan Leaf

Post 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.
User avatar
johu
Site Admin
Posts: 6227
Joined: Thu Nov 08, 2018 10:52 pm
Location: Kassel/Germany
Has thanked: 228 times
Been thanked: 1272 times
Contact:

Re: VW Touran powered by Nissan Leaf

Post 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 :)
Support R/D and forum on Patreon: https://patreon.com/openinverter - Subscribe on odysee: https://odysee.com/@openinverter:9
arber333
Posts: 3403
Joined: Mon Dec 24, 2018 1:37 pm
Location: Slovenia
Has thanked: 96 times
Been thanked: 287 times
Contact:

Re: VW Touran powered by Nissan Leaf

Post 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.
User avatar
johu
Site Admin
Posts: 6227
Joined: Thu Nov 08, 2018 10:52 pm
Location: Kassel/Germany
Has thanked: 228 times
Been thanked: 1272 times
Contact:

Re: VW Touran powered by Nissan Leaf

Post by johu »

Test drive!
Support R/D and forum on Patreon: https://patreon.com/openinverter - Subscribe on odysee: https://odysee.com/@openinverter:9
User avatar
Jack Bauer
Posts: 3564
Joined: Wed Dec 12, 2018 5:24 pm
Location: Ireland
Has thanked: 1 time
Been thanked: 93 times
Contact:

Re: VW Touran powered by Nissan Leaf

Post by Jack Bauer »

Fantastic progress:)
I'm going to need a hacksaw
User avatar
Kevin Sharpe
Posts: 1345
Joined: Fri Dec 14, 2018 9:24 pm
Location: Ireland and US
Been thanked: 7 times

Re: VW Touran powered by Nissan Leaf

Post by Kevin Sharpe »

Very cool :)

Are you going to list the video so that we can share the good news on social media?
This is a personal post and I disclaim all responsibility for any loss or damage which any person may suffer from reliance on the information and material in this post or any opinion, conclusion or recommendation in the information and material.
User avatar
langoo
Posts: 65
Joined: Thu May 09, 2019 6:27 pm
Location: Varberg, Sweden

Re: VW Touran powered by Nissan Leaf

Post by langoo »

Great to see some more progress :)
Robin Hellström
MR Electronics AB
User avatar
johu
Site Admin
Posts: 6227
Joined: Thu Nov 08, 2018 10:52 pm
Location: Kassel/Germany
Has thanked: 228 times
Been thanked: 1272 times
Contact:

Re: VW Touran powered by Nissan Leaf

Post by johu »

More progress here: viewtopic.php?f=7&t=153

Video is now listed, thanks for sharing :)
Support R/D and forum on Patreon: https://patreon.com/openinverter - Subscribe on odysee: https://odysee.com/@openinverter:9
User avatar
johu
Site Admin
Posts: 6227
Joined: Thu Nov 08, 2018 10:52 pm
Location: Kassel/Germany
Has thanked: 228 times
Been thanked: 1272 times
Contact:

Re: VW Touran powered by Nissan Leaf

Post by johu »

Special release for forum:
Support R/D and forum on Patreon: https://patreon.com/openinverter - Subscribe on odysee: https://odysee.com/@openinverter:9
doobedoobedo
Posts: 260
Joined: Sat Jan 12, 2019 12:39 am
Location: UK

Re: VW Touran powered by Nissan Leaf

Post by doobedoobedo »

Awesome. Great that you got to the bottom of it :).
arber333
Posts: 3403
Joined: Mon Dec 24, 2018 1:37 pm
Location: Slovenia
Has thanked: 96 times
Been thanked: 287 times
Contact:

Re: VW Touran powered by Nissan Leaf

Post 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.
User avatar
johu
Site Admin
Posts: 6227
Joined: Thu Nov 08, 2018 10:52 pm
Location: Kassel/Germany
Has thanked: 228 times
Been thanked: 1272 times
Contact:

Re: VW Touran powered by Nissan Leaf

Post 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.
Support R/D and forum on Patreon: https://patreon.com/openinverter - Subscribe on odysee: https://odysee.com/@openinverter:9
Craig Miles
Posts: 1
Joined: Sat May 11, 2019 3:49 pm

Re: VW Touran powered by Nissan Leaf

Post 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
User avatar
Bigpie
Posts: 1707
Joined: Wed Apr 10, 2019 8:11 pm
Location: South Yorkshire, UK
Has thanked: 77 times
Been thanked: 369 times

Re: VW Touran powered by Nissan Leaf

Post by Bigpie »

Navigate to the sub forum you want to post in and hit 'New Topic'
Image
Have you not got this button available?
BMW E91 2006
ZombieVerter
GS450h
Outlander Charger DC/DC
Renault Kangoo 36kWh battery
User avatar
johu
Site Admin
Posts: 6227
Joined: Thu Nov 08, 2018 10:52 pm
Location: Kassel/Germany
Has thanked: 228 times
Been thanked: 1272 times
Contact:

Re: VW Touran powered by Nissan Leaf

Post by johu »

Back on topic :D
Support R/D and forum on Patreon: https://patreon.com/openinverter - Subscribe on odysee: https://odysee.com/@openinverter:9
User avatar
Jack Bauer
Posts: 3564
Joined: Wed Dec 12, 2018 5:24 pm
Location: Ireland
Has thanked: 1 time
Been thanked: 93 times
Contact:

Re: VW Touran powered by Nissan Leaf

Post by Jack Bauer »

That is great work Johannes. Well done.

Also spotted a nice white E36 at 3.40 :)
I'm going to need a hacksaw
Post Reply