Halved current during field weakening
- celeron55
- Posts: 776
- Joined: Thu Jul 04, 2019 3:04 pm
- Location: Finland
- Has thanked: 28 times
- Been thanked: 110 times
- Contact:
Re: Halved current during field weakening
I'm playing with the MTPA calculation in LibreOffice and it looks like you can make a 10x adjustment and it only makes a 2x difference in output. So going really wild with these will make sense. Something along the lines of 10x IqminusId or 0.1x fluxLinkage will definitely cause more Id than Iq. But 2x or 0.5x respectively might have no discernable effect.
- Attachments
-
- mtpa1.ods
- (25.72 KiB) Downloaded 105 times
- johu
- Site Admin
- Posts: 5786
- Joined: Thu Nov 08, 2018 10:52 pm
- Location: Kassel/Germany
- Has thanked: 157 times
- Been thanked: 1021 times
- Contact:
Re: Halved current during field weakening
Oh, well that's not intended, I think.celeron55 wrote: ↑Sun Jun 13, 2021 9:08 amWhy isn't lqminusldSquaredBs10 = lqminusld^2? It seems to be the value of lqminusld^2 / 2, i.e. half the correct value. My calculator is telling me lqminusldSquaredBs10 should be 0.03445, not 0.01722. 10-bit left shift equals multiplying by 1024, right?Code: Select all
static const s32fp lqminusldSquaredBs10 = FP_FROMFLT(0.01722); //additional 10-bit left shift because otherwise it can't be represented static const s32fp lqminusld = FP_FROMFLT(0.0058);
Yes that's exactly why I didn't make these parameters let alone auto-tuning.celeron55 wrote: ↑Sun Jun 13, 2021 9:59 am I'm playing with the MTPA calculation in LibreOffice and it looks like you can make a 10x adjustment and it only makes a 2x difference in output. So going really wild with these will make sense. Something along the lines of 10x IqminusId or 0.1x fluxLinkage will definitely cause more Id than Iq. But 2x or 0.5x respectively might have no discernable effect.
Support R/D and forum on Patreon: https://patreon.com/openinverter - Subscribe on odysee: https://odysee.com/@openinverter:9
- bexander
- Posts: 835
- Joined: Tue Jun 16, 2020 6:00 pm
- Location: Gothenburg, Sweden
- Has thanked: 63 times
- Been thanked: 89 times
Re: Halved current during field weakening
I'm still stuck at the syncadv calculation.
If the sample/calculation time is always 80us, in my mind that then concludes to syncadv = frq * 5,24; based on that 80us at 400 Hz is 80us/(1/400) * 65536 = 2097 bits and syncadv/frq is 2097/400 = 5,24.
To my understanding, theoretically syncadv should start from 0 rpm and should increas linearly with increased speed.
On thing here is that fstat or frq starts at 2,8 * polePairRatio so there will be a jump from 0 to 5,6Hz in my case.
Does it always take 80us and how was this time measured?
Something seem to be out of sync as changing syncadv clearly have an effect on motor/inverter behaviour.
How hard is it to measure motor parameters? Can it be done or is the only possibility to test random values and see what works best?
If the sample/calculation time is always 80us, in my mind that then concludes to syncadv = frq * 5,24; based on that 80us at 400 Hz is 80us/(1/400) * 65536 = 2097 bits and syncadv/frq is 2097/400 = 5,24.
To my understanding, theoretically syncadv should start from 0 rpm and should increas linearly with increased speed.
On thing here is that fstat or frq starts at 2,8 * polePairRatio so there will be a jump from 0 to 5,6Hz in my case.
Does it always take 80us and how was this time measured?
Something seem to be out of sync as changing syncadv clearly have an effect on motor/inverter behaviour.
How hard is it to measure motor parameters? Can it be done or is the only possibility to test random values and see what works best?
- bexander
- Posts: 835
- Joined: Tue Jun 16, 2020 6:00 pm
- Location: Gothenburg, Sweden
- Has thanked: 63 times
- Been thanked: 89 times
Re: Halved current during field weakening
Just a thought, this 80us delay, what exactly is using most of the time? ADC, calculations, or output?
Is it possible that before FW this time is 80us and during FW this time increases due to different operations being performed?
Seem unlikely though, that there should be that large difference in these delays so that different syncadv should be required in different regions of operation.
Is it possible that before FW this time is 80us and during FW this time increases due to different operations being performed?
Seem unlikely though, that there should be that large difference in these delays so that different syncadv should be required in different regions of operation.
- celeron55
- Posts: 776
- Joined: Thu Jul 04, 2019 3:04 pm
- Location: Finland
- Has thanked: 28 times
- Been thanked: 110 times
- Contact:
Re: Halved current during field weakening
Syncadv is working fine. What you're seeing is just the ability of wrong syncadv (your edited value) to change the timing towards Id.
It's the wrong way to change the timing though, syncadv is not meant for doing this. If I were you I'd move to editing the IqminusId and fluxLinkage values which are actually meant for adjusting the Id/Iq ratio. See my previous post where I tested how much they have to be changed (a lot) in order for there to be a large enough effect.
It's the wrong way to change the timing though, syncadv is not meant for doing this. If I were you I'd move to editing the IqminusId and fluxLinkage values which are actually meant for adjusting the Id/Iq ratio. See my previous post where I tested how much they have to be changed (a lot) in order for there to be a large enough effect.
- johu
- Site Admin
- Posts: 5786
- Joined: Thu Nov 08, 2018 10:52 pm
- Location: Kassel/Germany
- Has thanked: 157 times
- Been thanked: 1021 times
- Contact:
Re: Halved current during field weakening
Basically At cycle n-1 the resolver exciter pin is toggled and 40us later the resolver return is read. Another 113-40us=73us later we use this resolver return for our calculations.bexander wrote: ↑Mon Jun 14, 2021 5:20 am Just a thought, this 80us delay, what exactly is using most of the time? ADC, calculations, or output?
Is it possible that before FW this time is 80us and during FW this time increases due to different operations being performed?
Seem unlikely though, that there should be that large difference in these delays so that different syncadv should be required in different regions of operation.
More precisely, the actual delay between toggling the pin and seeing that actual change on the return lines is 113+40us (measured with a scope). That is mainly caused by the low pass filter that converts rectangle to sine. So when the exciter swings positive, we know this is caused by the exciter PIN going negative in cycle n-2. This doesn't affect the "age" of the reading though!
Support R/D and forum on Patreon: https://patreon.com/openinverter - Subscribe on odysee: https://odysee.com/@openinverter:9
- bexander
- Posts: 835
- Joined: Tue Jun 16, 2020 6:00 pm
- Location: Gothenburg, Sweden
- Has thanked: 63 times
- Been thanked: 89 times
Re: Halved current during field weakening
johu: Ok, so the total delay is then 153us and that results in the factor of 10 in the syncadv calculation. Great!
celeron55:
Since I'm experiencing some low speed stuttering and this got worse when I increased syncadv I'm interested in fully understanding this.
I do agree that changing syncadv will not solve the FW or id/iq problem. This will most likely require tuning of the parameters you mention.
celeron55:
Since I'm experiencing some low speed stuttering and this got worse when I increased syncadv I'm interested in fully understanding this.
I do agree that changing syncadv will not solve the FW or id/iq problem. This will most likely require tuning of the parameters you mention.
- bexander
- Posts: 835
- Joined: Tue Jun 16, 2020 6:00 pm
- Location: Gothenburg, Sweden
- Has thanked: 63 times
- Been thanked: 89 times
Re: Halved current during field weakening
I thought the syncadv where to compensate the whole chain from rotor position measurement to change in winding produced flux, so that the flux change is in sync with the rotor position? Are there other parameters compensating for to later parts of the chain?johu wrote: ↑Mon Jun 14, 2021 6:59 am Basically At cycle n-1 the resolver exciter pin is toggled and 40us later the resolver return is read. Another 113-40us=73us later we use this resolver return for our calculations.
More precisely, the actual delay between toggling the pin and seeing that actual change on the return lines is 113+40us (measured with a scope). That is mainly caused by the low pass filter that converts rectangle to sine. So when the exciter swings positive, we know this is caused by the exciter PIN going negative in cycle n-2. This doesn't affect the "age" of the reading though!
Anyway, if one starts to measure time from toggling the resolver exciter signal and most of the delay is due to the propagation time in the square-to-sine filter then I don't think the time will be correct? The delay time should be measured from when the actual position measurement is done.
If from toggling it takes 30us for the signal to get through the filter and then during the last 10us it goes through the exciter coil, sens coil and return signal filter back to the stm32. During the first 30us the motor will turn before its position is measured so the starting time of the delay time should be when the signal meets the resolver hence the time will be 10us and not 40us in this example. Then adding the wait time for the next cycle where calculation starts, 73us.
- bexander
- Posts: 835
- Joined: Tue Jun 16, 2020 6:00 pm
- Location: Gothenburg, Sweden
- Has thanked: 63 times
- Been thanked: 89 times
Re: Halved current during field weakening
So testing something like this might be a good idea.
1) Start with setting lqminusldSquaredBs10 = 0.03445.
2) Test with FluxLinkage = 0.01.
3) FluxLinkade back to stock (0.09) and set lqminusld = 0.02 and lqminusldSquaredBs10 = 0.4096.
Any other ideas?
1) Start with setting lqminusldSquaredBs10 = 0.03445.
2) Test with FluxLinkage = 0.01.
3) FluxLinkade back to stock (0.09) and set lqminusld = 0.02 and lqminusldSquaredBs10 = 0.4096.
Any other ideas?
- bexander
- Posts: 835
- Joined: Tue Jun 16, 2020 6:00 pm
- Location: Gothenburg, Sweden
- Has thanked: 63 times
- Been thanked: 89 times
Re: Halved current during field weakening
I get different result when I tested in LibreOffice. I get increased Id and decreased Iq, which is what one would want, right?celeron55 wrote: ↑Sun Jun 13, 2021 9:08 am Why isn't lqminusldSquaredBs10 = lqminusld^2? It seems to be the value of lqminusld^2 / 2, i.e. half the correct value. My calculator is telling me lqminusldSquaredBs10 should be 0.03445, not 0.01722. 10-bit left shift equals multiplying by 1024, right?
Making that change will cause slightly less Id and slightly more Iq, so it obviously isn't a solution to this problem though.
- johu
- Site Admin
- Posts: 5786
- Joined: Thu Nov 08, 2018 10:52 pm
- Location: Kassel/Germany
- Has thanked: 157 times
- Been thanked: 1021 times
- Contact:
Re: Halved current during field weakening
with the "corrected" one it's a bit too much id for my taste. Didn't think this should ever exceed iq.
Support R/D and forum on Patreon: https://patreon.com/openinverter - Subscribe on odysee: https://odysee.com/@openinverter:9
- celeron55
- Posts: 776
- Joined: Thu Jul 04, 2019 3:04 pm
- Location: Finland
- Has thanked: 28 times
- Been thanked: 110 times
- Contact:
Re: Halved current during field weakening
You can't argue with the motor. If it wants it, what can you do?
In my opinion this absolutely needs to be tested before people drop the Q211 MGR from their projects as underpowered at reasonable voltages.
In my opinion this absolutely needs to be tested before people drop the Q211 MGR from their projects as underpowered at reasonable voltages.
- bexander
- Posts: 835
- Joined: Tue Jun 16, 2020 6:00 pm
- Location: Gothenburg, Sweden
- Has thanked: 63 times
- Been thanked: 89 times
Re: Halved current during field weakening
My plan is to test this on Saturday morning.
To me this makes sense as you sacrifice Iq or torque to get speed during FW but tests will tell.
It is a bit strange that it effects the MGR so strongly. I would imagine the Leaf motor or any other motor for that matter to suffer from the same thing.
To me this makes sense as you sacrifice Iq or torque to get speed during FW but tests will tell.
It is a bit strange that it effects the MGR so strongly. I would imagine the Leaf motor or any other motor for that matter to suffer from the same thing.
-
- Posts: 898
- Joined: Fri Apr 26, 2019 5:40 pm
- Has thanked: 291 times
- Been thanked: 177 times
Re: Halved current during field weakening
Have nothing to contribute other than general cheerleading. You guys are making great progress.
- johu
- Site Admin
- Posts: 5786
- Joined: Thu Nov 08, 2018 10:52 pm
- Location: Kassel/Germany
- Has thanked: 157 times
- Been thanked: 1021 times
- Contact:
Re: Halved current during field weakening
I really need to find out why this is only 1/2 of what is expected. Maybe there is a /2 in the formula which I factored in.
Support R/D and forum on Patreon: https://patreon.com/openinverter - Subscribe on odysee: https://odysee.com/@openinverter:9
Re: Halved current during field weakening
I have a charging issue with mine at the moment but I’m following this thread with interest. Great work so far!
- bexander
- Posts: 835
- Joined: Tue Jun 16, 2020 6:00 pm
- Location: Gothenburg, Sweden
- Has thanked: 63 times
- Been thanked: 89 times
Re: Halved current during field weakening
I think I agree with johu, Id should not be larger than Iq. That makes no sens.
Found this
https://se.mathworks.com/help/mcb/ref/m ... rence.html
When looking under Interior PMSM the equation is close but does the openinverter not use any of the FW stuff? Might perhaps explain why it is hard to get torque under FW.
Found this
https://se.mathworks.com/help/mcb/ref/m ... rence.html
When looking under Interior PMSM the equation is close but does the openinverter not use any of the FW stuff? Might perhaps explain why it is hard to get torque under FW.
- johu
- Site Admin
- Posts: 5786
- Joined: Thu Nov 08, 2018 10:52 pm
- Location: Kassel/Germany
- Has thanked: 157 times
- Been thanked: 1021 times
- Contact:
Re: Halved current during field weakening
Just found the original post: viewtopic.php?p=3519#p3519
So there are indeed some factors in there that don't show up in code:
Now keep in mind lqminusldSquaredBs10 is already lqminusld²/2. Someone mind hacking above formula into a spreadsheet?
So there are indeed some factors in there that don't show up in code:
Code: Select all
s32fp term1 = fpsqrt(fluxLinkage2 + ((lqminusldSquaredBs10 * isSquared) >> 10));
idref = FP_TOINT(FP_DIV(fluxLinkage - term1, lqminusld));
Support R/D and forum on Patreon: https://patreon.com/openinverter - Subscribe on odysee: https://odysee.com/@openinverter:9
- bexander
- Posts: 835
- Joined: Tue Jun 16, 2020 6:00 pm
- Location: Gothenburg, Sweden
- Has thanked: 63 times
- Been thanked: 89 times
Re: Halved current during field weakening
The equation presented by johu is equal to the one I found and linked to in my above post.
Anyway, results There are differences so I guess the SW can be adjusted.
Looking at the plot according to the equation, Id is always lower than Iq but compared to SW Id is increased.
EDIT: attached the spredsheet
Anyway, results There are differences so I guess the SW can be adjusted.
Looking at the plot according to the equation, Id is always lower than Iq but compared to SW Id is increased.
EDIT: attached the spredsheet
- bexander
- Posts: 835
- Joined: Tue Jun 16, 2020 6:00 pm
- Location: Gothenburg, Sweden
- Has thanked: 63 times
- Been thanked: 89 times
Re: Halved current during field weakening
By the way, where does the value LdminusLq origin from? Do you have any values of Ld and Lq? Thinking that they are whats needed to calculate the base speed and idfw according to what I linked previously.
- celeron55
- Posts: 776
- Joined: Thu Jul 04, 2019 3:04 pm
- Location: Finland
- Has thanked: 28 times
- Been thanked: 110 times
- Contact:
Re: Halved current during field weakening
Quoting johu from the "FOC low speed stuttering" thread (viewtopic.php?p=28839#p28839):
Can it be explained in this case why the FW controller isn't increasing Id when the motor isn't accepting enough current? Is it hitting a configurable limit? If so, what does one need to change to allow it to go much higher than it currently does? Is the only limit the "50% of throtcur" and is the limit actually working as intended? Can the internal status of the controller be graphed?
- johu
- Site Admin
- Posts: 5786
- Joined: Thu Nov 08, 2018 10:52 pm
- Location: Kassel/Germany
- Has thanked: 157 times
- Been thanked: 1021 times
- Contact:
Re: Halved current during field weakening
I found these in a paper about the Prius motor. Since the outcome of MTPA only varies slightly with changing inductance and fluxLinkage I decided to hard-code them.
I will fix the equation now and post software here.
To me it looks like it is running out of voltage. The 5.05.R and upwards have a spot value "ifw" that outputs the request of the FW controller.celeron55 wrote: ↑Fri Jun 18, 2021 7:31 am Can it be explained in this case why the FW controller isn't increasing Id when the motor isn't accepting enough current? Is it hitting a configurable limit? If so, what does one need to change to allow it to go much higher than it currently does? Is the only limit the "50% of throtcur" and is the limit actually working as intended? Can the internal status of the controller be graphed?
Support R/D and forum on Patreon: https://patreon.com/openinverter - Subscribe on odysee: https://odysee.com/@openinverter:9
- johu
- Site Admin
- Posts: 5786
- Joined: Thu Nov 08, 2018 10:52 pm
- Location: Kassel/Germany
- Has thanked: 157 times
- Been thanked: 1021 times
- Contact:
Re: Halved current during field weakening
This software has the correct formula.
Code: Select all
//factor of 8 has been incorporated into the right shift (7 instead of 10)
s32fp term1 = fpsqrt(fluxLinkage2 + ((lqminusldSquaredBs10 * isSquared) >> 7));
idref = FP_TOINT(FP_DIV(fluxLinkage - term1, 4 * lqminusld));
- Attachments
-
- stm32_foc.bin
- (42.2 KiB) Downloaded 86 times
Support R/D and forum on Patreon: https://patreon.com/openinverter - Subscribe on odysee: https://odysee.com/@openinverter:9
- bexander
- Posts: 835
- Joined: Tue Jun 16, 2020 6:00 pm
- Location: Gothenburg, Sweden
- Has thanked: 63 times
- Been thanked: 89 times
Re: Halved current during field weakening
I'm I missunderstanding, but if you calculate Id and Iq from MTPA and then if Iq isn't reached it adds further to Id, without decreasing Iq? That would result in the square sum of Iq and Id are larger than square of Is. If so it makes sens that the Id bottoms out, or runs out of voltage if you will.celeron55 wrote: ↑Fri Jun 18, 2021 7:31 am Quoting johu from the "FOC low speed stuttering" thread (viewtopic.php?p=28839#p28839):Can it be explained in this case why the FW controller isn't increasing Id when the motor isn't accepting enough current? Is it hitting a configurable limit? If so, what does one need to change to allow it to go much higher than it currently does? Is the only limit the "50% of throtcur" and is the limit actually working as intended? Can the internal status of the controller be graphed?
I think using this equation, found in the link I posted previously, for Id_fw is more refined but will require knowing Ld and Lq. Are the Ld and Lq stated in that Prius paper?
Plan to test the new SW tomorrow morning and report back.
Will try to add Ifw to the plot as well.
- johu
- Site Admin
- Posts: 5786
- Joined: Thu Nov 08, 2018 10:52 pm
- Location: Kassel/Germany
- Has thanked: 157 times
- Been thanked: 1021 times
- Contact:
Re: Halved current during field weakening
Yes and no. Id request always has priority over iq request. So if we run out of voltage iq will be reduced first. That said there are probably better ways to do field weakening just not quite as universal.bexander wrote: ↑Fri Jun 18, 2021 9:36 am I'm I missunderstanding, but if you calculate Id and Iq from MTPA and then if Iq isn't reached it adds further to Id, without decreasing Iq? That would result in the square sum of Iq and Id are larger than square of Is. If so it makes sens that the Id bottoms out, or runs out of voltage if you will.
Support R/D and forum on Patreon: https://patreon.com/openinverter - Subscribe on odysee: https://odysee.com/@openinverter:9