[DRIVING] Audi A2 /w Prius Gen2 Transaxle & Inverter  [FINISHED]

Tell us about the project you do with the open inverter
User avatar
johu
Site Admin
Posts: 5768
Joined: Thu Nov 08, 2018 10:52 pm
Location: Kassel/Germany
Has thanked: 157 times
Been thanked: 1009 times
Contact:

Re: Audi A2 /w Prius Gen2 Transaxle & Inverter

Post by johu »

More test driving.

Manual IFW tests were quite successful as soon as I brought in Petes syncadv with value 5. When I bring FW controller back in FW is still thrown in as a lump and ends up in positive feedback - more IFW, more amplitude, more IFW until saturation and loss of control. I'm still not sure whether ud should be frequency dependent or whether this is also some artifact. With fwki set to 0 at least I get out of saturation when letting go throttle. FW already starts at 30 kph when fwmargin is set to 5000.

Another interesting observation with manualifw: it prevents the uncultivated stopping and starting by keeping the gate drivers busy so they don't just dump 50/50 dutycycle when they think amplitude is too low. So this should go in there for Prius inverters.

I'm thinking of taking a step back and making FW just frequency dependent. So at some frequency it is slowly brought in and then ramped up to some maximum that is reached at fmax.

The inverter is incredible. After all that torture it was 28°C.

EDIT: at some point when it was accelerating on its own (uphill) I just let it run and reached 70 kph. It was still pulling strong.
Support R/D and forum on Patreon: https://patreon.com/openinverter - Subscribe on odysee: https://odysee.com/@openinverter:9
Pete9008
Posts: 1801
Joined: Sun Apr 03, 2022 1:57 pm
Has thanked: 102 times
Been thanked: 347 times

Re: Audi A2 /w Prius Gen2 Transaxle & Inverter

Post by Pete9008 »

Interesting! Were you able to use the manual control to try +Id to see what effect that had? The positive feedback is really odd, still sounds like a sign reversal somewhere?

Any chance of a log, would really like to understand what is going on?

Edit - which change allowed it to accelerate to higher speeds?
User avatar
Jack Bauer
Posts: 3563
Joined: Wed Dec 12, 2018 5:24 pm
Location: Ireland
Has thanked: 1 time
Been thanked: 87 times
Contact:

Re: Audi A2 /w Prius Gen2 Transaxle & Inverter

Post by Jack Bauer »

But Johannes! the internet tells us the prius inverter can only do 100amps...
I'm going to need a hacksaw
Pete9008
Posts: 1801
Joined: Sun Apr 03, 2022 1:57 pm
Has thanked: 102 times
Been thanked: 347 times

Re: Audi A2 /w Prius Gen2 Transaxle & Inverter

Post by Pete9008 »

Think I may have figured out what's going on here. Need to add some missing terms to the simulator equations and test it out later but what I think is happening is this.

There is a term in the IPM equations for uq which is proportional to Ld, Id and speed. This doesn't include flux linkage so isn't affected by field weakening which means it just increases with frequency. This could well be causing the positive feedback on the fw. What it means is that there is a max -Id beyond which further increases do more harm than good; this will vary from motor to motor but it may be possible to calculate the optimum value.
User avatar
johu
Site Admin
Posts: 5768
Joined: Thu Nov 08, 2018 10:52 pm
Location: Kassel/Germany
Has thanked: 157 times
Been thanked: 1009 times
Contact:

Re: Audi A2 /w Prius Gen2 Transaxle & Inverter

Post by johu »

Got up to 100 kph and still accelerating. Not controlled though. But I can drive 80 kph with full control now. Here is the 100 kph run
grafik.png
So 250 Hz or 3750 rpm makes 100 kph with the small Audi tires. Lot of drama for that kind of speed.
Also still haven't arrived at good curkp/ki values, you can see (and I could feel/hear) that they are oscillating slowly.

That is interesting with the FW limit. How to find out?
Jack Bauer wrote: Thu Oct 13, 2022 10:33 am But Johannes! the internet tells us the prius inverter can only do 100amps...
I definitely saw 300A on the DC side when I had to force the motor to stop.
Attachments
stm32_foc.bin
(48.57 KiB) Downloaded 72 times
params.json
(1.49 KiB) Downloaded 79 times
Support R/D and forum on Patreon: https://patreon.com/openinverter - Subscribe on odysee: https://odysee.com/@openinverter:9
Pete9008
Posts: 1801
Joined: Sun Apr 03, 2022 1:57 pm
Has thanked: 102 times
Been thanked: 347 times

Re: Audi A2 /w Prius Gen2 Transaxle & Inverter

Post by Pete9008 »

johu wrote: Thu Oct 13, 2022 1:13 pm That is interesting with the FW limit. How to find out?
A csv log would be good, I can compare it to the simulation results to give a sanity check as otherwise the simulation could be comple rubbish. Then need to check whether the simulation agrees with the theory, if it does I can then use it to better understand what is going on and try different ideas to sort it.
User avatar
johu
Site Admin
Posts: 5768
Joined: Thu Nov 08, 2018 10:52 pm
Location: Kassel/Germany
Has thanked: 157 times
Been thanked: 1009 times
Contact:

Re: Audi A2 /w Prius Gen2 Transaxle & Inverter

Post by johu »

I could make you a low resolution one if the rubber mounts hadn't come off :(
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: 5768
Joined: Thu Nov 08, 2018 10:52 pm
Location: Kassel/Germany
Has thanked: 157 times
Been thanked: 1009 times
Contact:

Re: Audi A2 /w Prius Gen2 Transaxle & Inverter

Post by johu »

Just noticed at time 21445 is when I came off the accelerator. Uq changes from -8000 to 0. Apparently it wants to cross 0 but I don't let it, therefor it doesn't regen but keeps driving
Support R/D and forum on Patreon: https://patreon.com/openinverter - Subscribe on odysee: https://odysee.com/@openinverter:9
Pete9008
Posts: 1801
Joined: Sun Apr 03, 2022 1:57 pm
Has thanked: 102 times
Been thanked: 347 times

Re: Audi A2 /w Prius Gen2 Transaxle & Inverter

Post by Pete9008 »

johu wrote: Thu Oct 13, 2022 1:41 pm I could make you a low resolution one if the rubber mounts hadn't come off :(
:(

Next time, low res would be fine.

There are some very odd things going on with the voltages there, is that with syncadv=6? Also is that plot for ifw proportional to freq?

Edit - Also how are you combining mtpa and fw Id in the plot, looks a little different to normal?
User avatar
johu
Site Admin
Posts: 5768
Joined: Thu Nov 08, 2018 10:52 pm
Location: Kassel/Germany
Has thanked: 157 times
Been thanked: 1009 times
Contact:

Re: Audi A2 /w Prius Gen2 Transaxle & Inverter

Post by johu »

Pete9008 wrote: Thu Oct 13, 2022 1:59 pm There are some very odd things going on with the voltages there, is that with syncadv=6? Also is that plot for ifw proportional to freq?

Edit - Also how are you combining mtpa and fw Id in the plot, looks a little different to normal?
syncadv=5

Here's the code

Code: Select all

         s32fp ffwstart = Param::Get(Param::ffwstart);
         s32fp fwMax = FP_DIV(50 * FP_MUL(Param::Get(Param::throtcur), (ffwstart - frq)), (Param::Get(Param::fmax) - ffwstart));
         fwMax = MIN(0, fwMax);
         fwController.SetMinMaxY(fwMax,0);
         s32fp ifw = Param::Get(Param::manualifw) + fwController.Run(Param::GetInt(Param::amp));
         dController.SetRef(idMtpa + ifw);
         Param::SetFixed(Param::ifw, ifw);
So I limit FW current with frequency. ffwstart=80 So at 80 Hz I start allowing FW current and at fmax=400 Hz (too high actually) I allow the full 175A
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: 5768
Joined: Thu Nov 08, 2018 10:52 pm
Location: Kassel/Germany
Has thanked: 157 times
Been thanked: 1009 times
Contact:

Re: Audi A2 /w Prius Gen2 Transaxle & Inverter

Post by johu »

I'm thinking I should also deploy that second P-controller that limits throttle input when maximum amplitude is approached. Like you did in your test code.
Support R/D and forum on Patreon: https://patreon.com/openinverter - Subscribe on odysee: https://odysee.com/@openinverter:9
Pete9008
Posts: 1801
Joined: Sun Apr 03, 2022 1:57 pm
Has thanked: 102 times
Been thanked: 347 times

Re: Audi A2 /w Prius Gen2 Transaxle & Inverter

Post by Pete9008 »

TBH I'd prefer to try and understand what is going on in there at the moment before adding more things. There are just so many things I don't understand there! :(

You mentioned that you came off the throttle at 21445, did you then get onto the brakes at around 21600? Were there any other throttle or brake changes during the plot, or anything else that might affect the data?

Edit - The following are the things that don't make sense to me. I anyone could explain any of these I'd appreciate it as they are winding me right up :(

Ud appears to be saturated full negative for most of the duration of the plot. This means that the increasing Ifw can't be having any effect as it can not decrease Ud any further. So
All FW current needed to get above base frequency must be being provided by another source, what is it (Mtpa or something else)?
If Ud us unvarying then what is causing the ripple seen in Id, it can't be the PI controller stability so what is it?

Uq appears to be saturated for most of the plot (limited by available modulation index for 1st half and zero limit for second), so
It can't be responsible for the ripple on Iq so what is?
When it does change at 21445 it has virtually no effect on Iq - why not?
When it does change at 21445 it appears to have more effect on Id (increasing its absolute value) - why?

At 21830 what changes to trigger Ud to increase?
Why does its increase have little effect on Id?
Why does its increase have significant effect on Iq?

After 21865 why does Ud need to be positive to keep Id negative?
After 21865 why is Id so large compared to Iq?
After 21865 why is the ripple only visible on Iq?
User avatar
johu
Site Admin
Posts: 5768
Joined: Thu Nov 08, 2018 10:52 pm
Location: Kassel/Germany
Has thanked: 157 times
Been thanked: 1009 times
Contact:

Re: Audi A2 /w Prius Gen2 Transaxle & Inverter

Post by johu »

Yes, good questions.
I'd still try above change to see what happens when voltages are kept from saturating.
Pete9008 wrote: Thu Oct 13, 2022 3:14 pm You mentioned that you came off the throttle at 21445, did you then get onto the brakes at around 21600? Were there any other throttle or brake changes during the plot, or anything else that might affect the data?
Yes I did use the mechanical brake to force the car to slow down, regen was not possible.
Pete9008 wrote: Thu Oct 13, 2022 3:14 pm Ud appears to be saturated full negative for most of the duration of the plot. This means that the increasing Ifw can't be having any effect as it can not decrease Ud any further. So
All FW current needed to get above base frequency must be being provided by another source, what is it (Mtpa or something else)?
Yes, MTPA is active otherwise the motor is too sluggish.
Pete9008 wrote: Thu Oct 13, 2022 3:14 pm If Ud us unvarying then what is causing the ripple seen in Id, it can't be the PI controller stability so what is it?
Uq appears to be saturated for most of the plot (limited by available modulation index for 1st half and zero limit for second), so
It can't be responsible for the ripple on Iq so what is?
That's what I also thought soon after. I wonder if it is something mechanical. If some cyclic friction were to slow down the motor then it would draw more current, right? Also the gate driver is a bit too "intelligent" for my taste. I mentioned before it maps, say, 49/51 duty cycle to 50/50. What other funky stuff will it do?
Pete9008 wrote: Thu Oct 13, 2022 3:14 pm When it does change at 21445 it has virtually no effect on Iq - why not?
When it does change at 21445 it appears to have more effect on Id (increasing its absolute value) - why?
True, didn't even notice. If you simulate an ideal inverter, what can you say about the relationship ud/id and uq/iq. Are they both frequency dependent? At an equal slope? I somehow suspect there is still a mis-map between what split the controllers output and what the motor sees.
Pete9008 wrote: Thu Oct 13, 2022 3:14 pm At 21830 what changes to trigger Ud to increase?
Why does its increase have little effect on Id?
Why does its increase have significant effect on Iq?
I had slowed down enough for the controllers to come out of saturation and I finally got the regen I wanted. I noticed before that the transition from positive to negative torque triggers a sign change of ud. Why I don't know.
Pete9008 wrote: Thu Oct 13, 2022 3:14 pm After 21865 why does Ud need to be positive to keep Id negative?
because regen
Pete9008 wrote: Thu Oct 13, 2022 3:14 pm After 21865 why is Id so large compared to Iq?
After 21865 why is the ripple only visible on Iq?
Is it? Currents are on the left axis. So iq would be 40A on average, id about -40A. I reckon that's still the MTPA split. Ripple must have the same cause as before.

I noticed sometimes the takeoff is silk smooth and sometimes it judders about. That's why I think it is something mechanical. The driver side drive shaft is always in bent state because the transmission sits too far forward and it makes a tick tick tick noise the more torque is requested. I think I'll take that apart and check.
Support R/D and forum on Patreon: https://patreon.com/openinverter - Subscribe on odysee: https://odysee.com/@openinverter:9
Pete9008
Posts: 1801
Joined: Sun Apr 03, 2022 1:57 pm
Has thanked: 102 times
Been thanked: 347 times

Re: Audi A2 /w Prius Gen2 Transaxle & Inverter

Post by Pete9008 »

johu wrote: Thu Oct 13, 2022 6:21 pm That's what I also thought soon after. I wonder if it is something mechanical. If some cyclic friction were to slow down the motor then it would draw more current, right? Also the gate driver is a bit too "intelligent" for my taste. I mentioned before it maps, say, 49/51 duty cycle to 50/50. What other funky stuff will it do?
Good point, could well be. Either mechanical binding or the driver doing something similar to the 50/50 but near 0% and 100% could explain it. Thinking about it it has to be reasonably intelligent to add the dead time control, could the offset introduced by that be causing the effect?
johu wrote: Thu Oct 13, 2022 6:21 pm True, didn't even notice. If you simulate an ideal inverter, what can you say about the relationship ud/id and uq/iq. Are they both frequency dependent? At an equal slope? I somehow suspect there is still a mis-map between what split the controllers output and what the motor sees.
Agree, I think there is still something not quite right in the mapping of uq and ud onto the motor. It looks like the motor is seeing some Ud as Uq and vice versa. Might be worth increasing syncadv to say 7 to see if it improves?
johu wrote: Thu Oct 13, 2022 6:21 pm I had slowed down enough for the controllers to come out of saturation and I finally got the regen I wanted. I noticed before that the transition from positive to negative torque triggers a sign change of ud. Why I don't know.
Neither do I :(. Ive had another look at the equations and can't see anything there would suggest the sign change should happen. All I can think is it's Uq/Ud interraction and the change in Ud is actually having more effect on Iq than Id. This would suggest that there is soemthing not right with either the angle measurement (difficult to believe), the frq measurement or frq measurement delay (seems more likely) or the sync compensation. My worry is that until this starts to make sense all the results of any other changes we make are very unpredictable.
johu wrote: Thu Oct 13, 2022 6:21 pm because regen
Ditto to above.
johu wrote: Thu Oct 13, 2022 6:21 pm Is it? Currents are on the left axis. So iq would be 40A on average, id about -40A. I reckon that's still the MTPA split. Ripple must have the same cause as before.
Good point! I was looking at the wrong axis.
johu wrote: Thu Oct 13, 2022 6:21 pm I noticed sometimes the takeoff is silk smooth and sometimes it judders about. That's why I think it is something mechanical. The driver side drive shaft is always in bent state because the transmission sits too far forward and it makes a tick tick tick noise the more torque is requested. I think I'll take that apart and check.
CV joints can take quite a bit of angle (inner one to a lesser degree), in fact they don't like being perfectly straight as it concentrates the wear points. Have you got a picture of the angle? If it's making a noise then it is definitely worth checking out - could be causing the ripple too.

The thing that is complicating everything is it running open loop for so much of the time. While it is doing that iq and id will not be achieving the iqref/idref targets and so making sense of the plots becomes difficult. Would it be possible to get a plot for a part throttle run (enough to push things and get above base freq but not enough to drive things into saturation)? That might be a lot easier to read and if it makes sense it is a good sign that the 2nd P controller would help (it is going to be needed but adding it too soon just adds another layer of complexity that makes it harder to understand what is going on).

Another plot that would be useful is one with FW disabled. The results above suggest that Mtpa is generating more than enough -Id to do the job by itself and it would be interesting to know if that is actually the case. Part throttle again to prevent saturation/open loop.

Would it be possible to add ESP32 based data logging to this install?

I'll try to have a go at adding the missing equation terms to the simulator today. It's unlikely to shed much light on what's going on in the above plot but it should help understand what the limits on -Id/FW current are.
User avatar
johu
Site Admin
Posts: 5768
Joined: Thu Nov 08, 2018 10:52 pm
Location: Kassel/Germany
Has thanked: 157 times
Been thanked: 1009 times
Contact:

Re: Audi A2 /w Prius Gen2 Transaxle & Inverter

Post by johu »

Yes, with syncadv=5 and ldminuslq=10 I could also accelerate to 80 kph uphill, if I remember correctly without saturating the controllers. FW off and was only giving it mild throttle. That's why I hope to throttle limiting controller will help.
Of course coming off throttle gave excessive regen because FW is gone then.
Yes I could add the ESP32 to this build as the controller lives in a well accessible ModICE enclosure :)

Any yes I will try syncadv=7

Now have to fix the motor mounts on Audi or alternatively try on Touran. The latter certainly doesn't have any mechanical question marks.
Support R/D and forum on Patreon: https://patreon.com/openinverter - Subscribe on odysee: https://odysee.com/@openinverter:9
Pete9008
Posts: 1801
Joined: Sun Apr 03, 2022 1:57 pm
Has thanked: 102 times
Been thanked: 347 times

Re: Audi A2 /w Prius Gen2 Transaxle & Inverter

Post by Pete9008 »

ldminuslq of 10 seems quite high, that would explain why you don't seem to need any FW current! Do lower values reduce performance much?

The throttle limiter will help (and is needed in teh final solution) but my concern is that it could also mask problems and make diagnosis more difficult.If it would make testing safer now though then it's time to add it.

Be careful of higher syncadv values on the Touran. Simulation suggested they can have nasty side effects if you go to far beyond base freq (2x base seemed fine at any value of syncadv though). Personally I'd wait till the Audi is ready, I'm fairly risk adverse and the lower base freq speeds would be attractive!

Could we call syncadv something else now? Otherwise it's going to really confuse people coming back to old threads in the future!

On driveshafts the inner joint should be happy up to around 15degrees, a bit more is possible but depends on the specific joint and how much suspension travel there is.
User avatar
Ev8
Posts: 801
Joined: Sat Jan 30, 2021 11:05 am
Has thanked: 41 times
Been thanked: 149 times

Re: Audi A2 /w Prius Gen2 Transaxle & Inverter

Post by Ev8 »

I’m currently running a tune which probably isn’t a great idea but working, as I couldn’t get f/w to behave regardless of ldminuslq value,
I advanced the syncof to the point where unwanted regen disappeared when lifting off, for me about 16500, I then worked out that I could reduce this back towards syncof center by about 1000 for about every 11 points syncadv I added. This has allowed me to keep control in the above base frequency speeds that mtpa alone is capable of, it does however loose some wanted regen torque so less than ideal
Pete9008
Posts: 1801
Joined: Sun Apr 03, 2022 1:57 pm
Has thanked: 102 times
Been thanked: 347 times

Re: Audi A2 /w Prius Gen2 Transaxle & Inverter

Post by Pete9008 »

That's interesting, could you give a little more detail - which firmware, what's the ideal syncofs, what syncofs are you running, what syncadv, what ldminuslq, anything else that might be relevant?
User avatar
Ev8
Posts: 801
Joined: Sat Jan 30, 2021 11:05 am
Has thanked: 41 times
Been thanked: 149 times

Re: Audi A2 /w Prius Gen2 Transaxle & Inverter

Post by Ev8 »

Firmware you sent me so 5.20 with syncadv added back in, center of foc dip about 11000, ldminuslq=1 this certainly isn’t the right answer though. the further I try to reduce syncof back to ideal the more syncadv I need, but there’s a point which will be too much at high motor speeds, so I have to compromise with a slightly advanced starting syncof. I won’t spam Johu’s thread more with my silly ideas but interested to see what he finds
Pete9008
Posts: 1801
Joined: Sun Apr 03, 2022 1:57 pm
Has thanked: 102 times
Been thanked: 347 times

Re: Audi A2 /w Prius Gen2 Transaxle & Inverter

Post by Pete9008 »

If you could stick your current parameters on the simulator thread Ill have a look (in particular the syncofs and syncadv you are using but the full set would be good)? All good reference points for figuring out what's going on :)
Pete9008
Posts: 1801
Joined: Sun Apr 03, 2022 1:57 pm
Has thanked: 102 times
Been thanked: 347 times

Re: Audi A2 /w Prius Gen2 Transaxle & Inverter

Post by Pete9008 »

Been thinking a bit more about this and the best plot for checking the interaction of uq, ud, iq and id would be one showing them, plus frq, while coasting (no regen, no throttle, target of 0A for id and iq) down from just below base frequency.

The theory says that this should show uq ramping down from 100% modulation with ud, id and iq at or close to zero. Anything else suggests either a misunderstanding of the theory or a setup that needs adjusting.
User avatar
johu
Site Admin
Posts: 5768
Joined: Thu Nov 08, 2018 10:52 pm
Location: Kassel/Germany
Has thanked: 157 times
Been thanked: 1009 times
Contact:

Re: Audi A2 /w Prius Gen2 Transaxle & Inverter

Post by johu »

Motor mounts and other shaft seal fixed, now the torque arm was ripped apart. 4mm alu, just ripped right off! Small problem, easy fix.

Anyway, made that idle plot on a downhill (a BMW driver got very annoyed and overtook before a bent).
Of course I forgot frequency. I "accelerated" from about 30 to 55 on the downhill:
freewheel.png
I also deployed the throttle limiter and now indeed there is no more controller saturation. I had to bump up curki=10000 though, otherwise I got short lumps of unwanted regen with regen disabled. Otherwise it seems to drive fine at speed

EDIT: aand I just discovered why performance was a bit suboptimal. Had limited is to 100A (was supposed to be % limit)

So here's the limit code

Code: Select all

   float maxThrot = throttleLimitController.RunProportionalOnly(Param::GetInt(Param::amp));

   if (torquePercent > 0)
      torquePercent = MIN(maxThrot, torquePercent);
   else
      torquePercent = -MIN(maxThrot, -torquePercent);

   float is = Param::GetFloat(Param::throtcur) * torquePercent;
Attachments
stm32_foc.bin
(48.63 KiB) Downloaded 61 times
params.json
(1.48 KiB) Downloaded 74 times
Support R/D and forum on Patreon: https://patreon.com/openinverter - Subscribe on odysee: https://odysee.com/@openinverter:9
Pete9008
Posts: 1801
Joined: Sun Apr 03, 2022 1:57 pm
Has thanked: 102 times
Been thanked: 347 times

Re: Audi A2 /w Prius Gen2 Transaxle & Inverter

Post by Pete9008 »

That plot looks pretty much perfect :D

All the strange bits in the previous plots must have been due to the controller saturation?

How is it driving with the limiter?
User avatar
johu
Site Admin
Posts: 5768
Joined: Thu Nov 08, 2018 10:52 pm
Location: Kassel/Germany
Has thanked: 157 times
Been thanked: 1009 times
Contact:

Re: Audi A2 /w Prius Gen2 Transaxle & Inverter

Post by johu »

Yeah, looks like now there is hardly any frequency dependency on ud. Maybe because I increased syncadv to 7?

Driving with the limiter I can't yet say, see edit above ;)

EDIT: code now on github https://github.com/jsphuebner/stm32-sine
Support R/D and forum on Patreon: https://patreon.com/openinverter - Subscribe on odysee: https://odysee.com/@openinverter:9
Pete9008
Posts: 1801
Joined: Sun Apr 03, 2022 1:57 pm
Has thanked: 102 times
Been thanked: 347 times

Re: Audi A2 /w Prius Gen2 Transaxle & Inverter

Post by Pete9008 »

Could be, looked at it earlier and 7 is probably more realistic.

Got to say that data is looking pretty good, hopefully it will drive just as well :)
Post Reply