IPM Motor - Auto-setup
Re: IPM Motor - Auto-setup
Hi Pete did you update the bin for this on your GitHub? Just realised I can test it on mg1 if I put mg2 in run mode (only mg2 control board controls the contactors)
-
- Posts: 1801
- Joined: Sun Apr 03, 2022 1:57 pm
- Has thanked: 102 times
- Been thanked: 348 times
Re: IPM Motor - Auto-setup
Good point!
Didn't check but it should have pulled the new one across.
Edit - just checked and latest files are on there.
-
- Posts: 1801
- Joined: Sun Apr 03, 2022 1:57 pm
- Has thanked: 102 times
- Been thanked: 348 times
Re: IPM Motor - Auto-setup
Been thinking about how to setup the controller gains when first setting up a new motor and have come up with this:
These are not intended to be final values, just a way of getting something sensible in there for initial tests. Might also be worth starting a bit lower initially, say half the value, until confidence is built up (to reduces the chance of control loop oscillation from setting them too high).
The values in there are just based on parameters published for the Outlander front generator, rx450h and mgr. Including others would probably improve accuracy but the values for these seemed to fit well with theory and I could find them and so will do for now!
The spreadsheet used to generate is attached if anyone wants to have a look at it or add more data.
The idea is that you use the inductance value that the phase check test gives and the voltage you are running at to look up the values to use for kp and ki. For example in Bigpie's case of 0.2mH and 44V above you would set kp to around 508 and ki to around 9632 for the initial spin tests (and then drop down to 73 and 1376 when running at normal 96s pack voltage).These are not intended to be final values, just a way of getting something sensible in there for initial tests. Might also be worth starting a bit lower initially, say half the value, until confidence is built up (to reduces the chance of control loop oscillation from setting them too high).
The values in there are just based on parameters published for the Outlander front generator, rx450h and mgr. Including others would probably improve accuracy but the values for these seemed to fit well with theory and I could find them and so will do for now!
The spreadsheet used to generate is attached if anyone wants to have a look at it or add more data.
- Attachments
-
- StartingGains.ods
- (21.29 KiB) Downloaded 47 times
- Bigpie
- Posts: 1599
- Joined: Wed Apr 10, 2019 8:11 pm
- Location: South Yorkshire, UK
- Has thanked: 75 times
- Been thanked: 309 times
Re: IPM Motor - Auto-setup
Just posting latest findings. I don't seem to get getting an average error. Maybe I misread last night?
This is Bi Directional the the ki kp increased by a factor of 8
Running in forward mode but with no manual id, looks to give decent resolver feedback.
This is Bi Directional the the ki kp increased by a factor of 8
Running in forward mode but with no manual id, looks to give decent resolver feedback.
VW Beetle 2003
Outlander front generator
Prius Gen 3 inverter (EVBMW logic board)
Outlander charger
3x Golf GTE batteries
Chademo Charging
Outlander water heater
Outlander front generator
Prius Gen 3 inverter (EVBMW logic board)
Outlander charger
3x Golf GTE batteries
Chademo Charging
Outlander water heater
-
- Posts: 1801
- Joined: Sun Apr 03, 2022 1:57 pm
- Has thanked: 102 times
- Been thanked: 348 times
Re: IPM Motor - Auto-setup
It still doesn't seem to be following the field correctly
What does it do on a forward spin now? (until that spins reliably there's not much point in trying to find syncofs)
Have you checked the phase resistances, is it possible that there is a problem with the motor?
Edit - not sure why the average error would have disappeared
Edit2 - Assume the missing bits in testangle in the first pic are due to wifi dropouts?
What does it do on a forward spin now? (until that spins reliably there's not much point in trying to find syncofs)
Have you checked the phase resistances, is it possible that there is a problem with the motor?
Edit - not sure why the average error would have disappeared
Edit2 - Assume the missing bits in testangle in the first pic are due to wifi dropouts?
- Bigpie
- Posts: 1599
- Joined: Wed Apr 10, 2019 8:11 pm
- Location: South Yorkshire, UK
- Has thanked: 75 times
- Been thanked: 309 times
Re: IPM Motor - Auto-setup
Forward seems to work with more id current
I gave it more id current.
I gave it more id current.
VW Beetle 2003
Outlander front generator
Prius Gen 3 inverter (EVBMW logic board)
Outlander charger
3x Golf GTE batteries
Chademo Charging
Outlander water heater
Outlander front generator
Prius Gen 3 inverter (EVBMW logic board)
Outlander charger
3x Golf GTE batteries
Chademo Charging
Outlander water heater
-
- Posts: 1801
- Joined: Sun Apr 03, 2022 1:57 pm
- Has thanked: 102 times
- Been thanked: 348 times
Re: IPM Motor - Auto-setup
Something just doesn't look right there, it's never going to be perfectly smooth but it should be a lot better than that (it appears to be going in the wrong direction sometimes!). It's almost like it's missing a phase (or half a phase maybe, just 1 IGBT)?
Is it worth checking the winding resistance of each phase on that motor? Do you have any way of checking that the PWM looks right on all three phases?
Other option is to log angle, pwm1, pwm2, pwm3, il1 and il2, stick it though a spreadsheet to calculate il3 and see what the current waveforms look like (I'm happy to do the spreadsheet bit if you post the log)?
Is it worth checking the winding resistance of each phase on that motor? Do you have any way of checking that the PWM looks right on all three phases?
Other option is to log angle, pwm1, pwm2, pwm3, il1 and il2, stick it though a spreadsheet to calculate il3 and see what the current waveforms look like (I'm happy to do the spreadsheet bit if you post the log)?
- Bigpie
- Posts: 1599
- Joined: Wed Apr 10, 2019 8:11 pm
- Location: South Yorkshire, UK
- Has thanked: 75 times
- Been thanked: 309 times
Re: IPM Motor - Auto-setup
Only had 1 probe to hand tonight. Each output phase with respect to HV gnd. This is fwd dir and 35 amps id
I span this motor with sine firmware the other week
All looks good.I span this motor with sine firmware the other week
VW Beetle 2003
Outlander front generator
Prius Gen 3 inverter (EVBMW logic board)
Outlander charger
3x Golf GTE batteries
Chademo Charging
Outlander water heater
Outlander front generator
Prius Gen 3 inverter (EVBMW logic board)
Outlander charger
3x Golf GTE batteries
Chademo Charging
Outlander water heater
-
- Posts: 1801
- Joined: Sun Apr 03, 2022 1:57 pm
- Has thanked: 102 times
- Been thanked: 348 times
Re: IPM Motor - Auto-setup
Can't fault those waveforms (why are they negative though if measured relative to HV gnd?), all the IGBT's appear to be working fine.
I'm out of ideas again.
Can't quite tell in the video, was the spin with the sin software much smoother? They should be virtually equivalent, both should apply the same rotating field to the motor.
I'm out of ideas again.
Can't quite tell in the video, was the spin with the sin software much smoother? They should be virtually equivalent, both should apply the same rotating field to the motor.
- Bigpie
- Posts: 1599
- Joined: Wed Apr 10, 2019 8:11 pm
- Location: South Yorkshire, UK
- Has thanked: 75 times
- Been thanked: 309 times
Re: IPM Motor - Auto-setup
I clipped the ground to the phases and poke the probe to the negative:D I think it span smoothly with sine and also old manual mode
VW Beetle 2003
Outlander front generator
Prius Gen 3 inverter (EVBMW logic board)
Outlander charger
3x Golf GTE batteries
Chademo Charging
Outlander water heater
Outlander front generator
Prius Gen 3 inverter (EVBMW logic board)
Outlander charger
3x Golf GTE batteries
Chademo Charging
Outlander water heater
-
- Posts: 1801
- Joined: Sun Apr 03, 2022 1:57 pm
- Has thanked: 102 times
- Been thanked: 348 times
Re: IPM Motor - Auto-setup
Makes sense
There is definitely something not right there. On the bidir plot you posted the motor is just oscillating between around -10 and +50degrees rather than doing a full rotation and in the video it's so uneven in places that is shakes the whole motor! I've had another look through the code but can't see anything and what should be equivalent code works fine here.
If you could do the log mentioned above I'll have a look at it but apart from that I'm out of ideas
-
- Posts: 1801
- Joined: Sun Apr 03, 2022 1:57 pm
- Has thanked: 102 times
- Been thanked: 348 times
Re: IPM Motor - Auto-setup
One final thought for today. There is one difference between the normal run mode code and mine, because mine is running in manual mode the ADC offset routine may not have run so I run it at the start of the first test. This shouldn't make any difference but if it isn't working right it could cause the kind of issues you are seeing. Do you get any ERR_HICUROFS errors logged?
Are you able to get a scope plot of the CT outputs while starting a forward test, any problem with the offset routine would clearly show up.
Are you able to get a scope plot of the CT outputs while starting a forward test, any problem with the offset routine would clearly show up.
- Bigpie
- Posts: 1599
- Joined: Wed Apr 10, 2019 8:11 pm
- Location: South Yorkshire, UK
- Has thanked: 75 times
- Been thanked: 309 times
Re: IPM Motor - Auto-setup
Yes, Ive seen hicurofs errors, can't remember what they are at moment, but seem to think I get them on my Prius inverter in the car too.
Not sure how to log the PWM values. Does the binary logging work in manual mode? Not sure I'll get chance tomorrow, but will try probe the current sensors output when I get chance. Also flip back to sine and see if it spins smoothly.
Not sure how to log the PWM values. Does the binary logging work in manual mode? Not sure I'll get chance tomorrow, but will try probe the current sensors output when I get chance. Also flip back to sine and see if it spins smoothly.
VW Beetle 2003
Outlander front generator
Prius Gen 3 inverter (EVBMW logic board)
Outlander charger
3x Golf GTE batteries
Chademo Charging
Outlander water heater
Outlander front generator
Prius Gen 3 inverter (EVBMW logic board)
Outlander charger
3x Golf GTE batteries
Chademo Charging
Outlander water heater
-
- Posts: 1801
- Joined: Sun Apr 03, 2022 1:57 pm
- Has thanked: 102 times
- Been thanked: 348 times
Re: IPM Motor - Auto-setup
Ignore me re the pwm values, forgot that they are not available as params. Haven't added logging to manual mode yet (seemed to be asking for trouble adding the extra complexity at the same time), probably ought to though! Do you have a working logging setup now?
A problem with the offset calibration could well cause this type of problem on the test spin modes. Might not affect the phase check as that uses rate of change rather than absolute current.
If you could get a scope capture the ideal would be of the first test run following a power up, idealy a test spin and ideally on a fairly slow timebase with a bit of the capture before the start and the rest while it's spinning.
Sorry for all the hassle getting it working and thanks for your persistence!
Edit - Just run the code up on a bluepill board and it all looks ok, pwm turns on and off in the right places and the current offset routine appears to run correctly (not possible to test it fully though as it isn't connected to anything). Still interested in the log and the scope capture if you have a chance though as an offset on the current sensors would explain all the effects seen.
Edit2 - One other thought - am I right in thinking that the sin code doesn't use the current sensors at all, it just applies a voltage waveform? If so that would also point to a current sensor issue.
A problem with the offset calibration could well cause this type of problem on the test spin modes. Might not affect the phase check as that uses rate of change rather than absolute current.
If you could get a scope capture the ideal would be of the first test run following a power up, idealy a test spin and ideally on a fairly slow timebase with a bit of the capture before the start and the rest while it's spinning.
Sorry for all the hassle getting it working and thanks for your persistence!
Edit - Just run the code up on a bluepill board and it all looks ok, pwm turns on and off in the right places and the current offset routine appears to run correctly (not possible to test it fully though as it isn't connected to anything). Still interested in the log and the scope capture if you have a chance though as an offset on the current sensors would explain all the effects seen.
Edit2 - One other thought - am I right in thinking that the sin code doesn't use the current sensors at all, it just applies a voltage waveform? If so that would also point to a current sensor issue.