FOC questions

hy,
happy new year!
can you explain a bit why it is needed to have injection at bottom pwm and at top pwm, what does it differ if you inject at top or at bottom, for inductance measurement.
i'm having a hard time getting useable current values it i inject at top for inductance measurement.
If you write a new value to the timer, it will only update the duty at the next update event - top or bottom. So if you write it in the "top" interrupt, it will get applied at "bottom".

If you are reading every "bottom" of timer, you then get the injection you want... it you are reading at top of timer... you get on average nothing.

If your interrupt takes too long, you get complete garbage.
 
hy,
thanks for clearing that up.
I have another question about hall startup, i see that you store (preload) the hall flux during run at speed and use it at low speed (to start the motor), my question is, after controller power up, and motor was not spined yet, and there are no stored hall flux, what is used for the first startup of the motor? because as i understand after the startup there is available the preloaded hall flux.
this function i was referring to preload the hall flux. can you explain a bit how that works for the first startup and after that?
void HallFluxMonitor(MESC_motor_typedef *_motor)
 
@mxlemming

i'm using predefined angles for each the 6 sectors during hall startup, the flux observer runs in the back to be ready for crossing to sensorless , then after a certain erpm threshold it switches to sensorless (fluxobserver).
the problem that i'm having with hall start up, is that for some motors do not make the sensored/sensorless crossing under load, it loses sink and squeeks (the angle rotates very fast), but they all make the crossing with no load, all fine, also once in sensorless i can load the motor heavily and is fine...
so my question is what parameters might affect the algorithm and, in under load condition to lose sink.
olso my previos question still stands about MESC hall startup.
 
Last edited:
@mxlemming
also how do you consider Ld and Lq for motors with winding delta or Y termination, i mean you measure with the LCR between 2 phase of the motor, than for Y termination you divide by 2 the value from LCR? how about Resistance? the same as inductance?
how about delta termination then?
then the MESC motor parameters measuring algorithm does it take in to account delta or Y termination?
 
FOC assumes star winding, even if it is delta. Therefore you simply divide the answer the lcr meter gives by two.

@mxlemming
also how do you consider Ld and Lq for motors with winding delta or Y termination, i mean you measure with the LCR between 2 phase of the motor, than for Y termination you divide by 2 the value from LCR? how about Resistance? the same as inductance?
how about delta termination then?
then the MESC motor parameters measuring algorithm does it take in to account delta or Y termination?
 
@mxlemming

i'm using predefined angles for each the 6 sectors during hall startup, the flux observer runs in the back to be ready for crossing to sensorless , then after a certain erpm threshold it switches to sensorless (fluxobserver).
the problem that i'm having with hall start up, is that for some motors do not make the sensored/sensorless crossing under load, it loses sink and squeeks (the angle rotates very fast), but they all make the crossing with no load, all fine, also once in sensorless i can load the motor heavily and is fine...
so my question is what parameters might affect the algorithm and, in under load condition to lose sink.
olso my previos question still stands about MESC hall startup.
The resistance is the key parameter. Higher resistance looks like the flux is lower and so it tends towards the observed flux reaching zero.
 
M
hy,
thanks for clearing that up.
I have another question about hall startup, i see that you store (preload) the hall flux during run at speed and use it at low speed (to start the motor), my question is, after controller power up, and motor was not spined yet, and there are no stored hall flux, what is used for the first startup of the motor? because as i understand after the startup there is available the preloaded hall flux.
this function i was referring to preload the hall flux. can you explain a bit how that works for the first startup and after that?
MESC has the ability to save parameters so this is only important the first time you set it up.
 
The resistance is the key parameter. Higher resistance looks like the flux is lower and so it tends towards the observed flux reaching zero.
@mxlemming
Now it makes sense to me, a few things that are happening: that is why only after a certain load/ Ph amps it loses sink during crossing from sensored to sensorless. In the flux formula, if the Voltage Va (or Vb) is smaller that Ia*Rm then Va-Ia*Rm tends to zero or even negative, i mean for ex, if Va is 5V and Ia is 50A and Rm is 0.1 ohms then rezult is 0. This also explains why, if i really crank fast the throttle, sometimes it will make the crossing, because Va will rise faster than the Ia, and Va-Ia*Rm will not be 0(or negetive) and at the crossing moment and there will be enough flux to keep sink. Now that is "cool science"
Thanks for clearing that up.
The motor with this crossing issue is a Vevor MY1020 (48V) , witch has a measured Rm of 230mohm, and am inductance of 80uH...
So i would need to lower Rm by a factor of 10, say 23mohm....
So my "conclusion" here, if you expect high current in system (>50A-100A), and a Vbus of 40-60V , then Rm "can not be over" say 20-50mohm, in order to have enough flux and not loose sink.
Now, what is the side effect (negative), from lowering the value of Rm? a bit of "phase lag/lead" sort of speaking ?
 
Last edited:
Your issue is most likely dead time and switching abheration. They look like resistance in reality so you need to tweak the resistance to unrealistic values to compensate it.

I recall in the other thread I was saying over and over to stop solving problems by applying massive gate resistance and capacitance ... Guess what. It makes your power stage get hot and also guess what... That heat is unaccounted for magnetic energy errors.

R becomes increasingly unimportant at high speed but still best to be compensating the issues by tackling the real problems to sticky plastering another parameter.

@mxlemming
Now it makes sense to me, a few things that are happening: that is why only after a certain load/ Ph amps it loses sink during crossing from sensored to sensorless. In the flux formula, if the Voltage Va (or Vb) is smaller that Ia*Rm then Va-Ia*Rm tends to zero or even negative, i mean for ex, if Va is 5V and Ia is 50A and Rm is 0.1 ohms then rezult is 0. This also explains why, if i really crank fast the throttle, sometimes it will make the crossing, because Va will rise faster than the Ia, and Va-Ia*Rm will not be 0(or negetive) and at the crossing moment and there will be enough flux to keep sink. Now that is "cool science"
Thanks for clearing that up.
The motor with this crossing issue is a Vevor MY1020 (48V) , witch has a measured Rm of 230mohm, and am inductance of 80uH...
So i would need to lower Rm by a factor of 10, say 23mohm....
So my "conclusion" here, if you expect high current in system (>50A-100A), and a Vbus of 40-60V , then Rm "can not be over" say 20-50mohm, in order to have enough flux and not loose sink.
Now, what is the side effect (negative), from lowering the value of Rm? a bit of "phase lag/lead" sort of speaking ?
 
Your issue is most likely dead time and switching abheration. They look like resistance in reality so you need to tweak the resistance to unrealistic values to compensate it.

I recall in the other thread I was saying over and over to stop solving problems by applying massive gate resistance and capacitance ... Guess what. It makes your power stage get hot and also guess what... That heat is unaccounted for magnetic energy errors.

R becomes increasingly unimportant at high speed but still best to be compensating the issues by tackling the real problems to sticky plastering another parameter.
@mxlemming
I do believe that there-s an issue some ware, but this hardware New 100A FOC controller project is with TOLL fets, all nicely and clean switching , low inductance layout, all the goodies and this is where i'm testing my FOC SW... so i don't know, but switching might not be the blame here... But if i think of what is in the path of the current (unwanted "aparent resistence"), the battery (16s 20Ah from moped) does have an China made BMS inside rated at 50A they say....so any aparent resistence in the current path, be it internal of ESC or external of ESC, is still resistence in the current path, witch mimics as motor resistence problem... just a thoat, me thinking...
 
Yes i forgot about this new hardware. Might still have to much dead time i don't know.

230mohm sounds like a lot for a motor. Have you verified this number? Remember the value you use for foc is half the phase to phase value.

Battery adds resistance but thats why you have a cap bank. It all adds up though... Could be a code error.

@mxlemming
I do believe that there-s an issue some ware, but this hardware New 100A FOC controller project is with TOLL fets, all nicely and clean switching , low inductance layout, all the goodies and this is where i'm testing my FOC SW... so i don't know, but switching might not be the blame here... But if i think of what is in the path of the current (unwanted "aparent resistence"), the battery (16s 20Ah from moped) does have an China made BMS inside rated at 50A they say....so any aparent resistence in the current path, be it internal of ESC or external of ESC, is still resistence in the current path, witch mimics as motor resistence problem... just a thoat, me thinking...
 
Yes i forgot about this new hardware. Might still have to much dead time i don't know.

230mohm sounds like a lot for a motor. Have you verified this number? Remember the value you use for foc is half the phase to phase value.

Battery adds resistance but thats why you have a cap bank. It all adds up though... Could be a code error.
@mxlemming
Previously i measured resistance with the "4 wire method" and it gave out that 230mohm, so....
I checked the motor resistance, well it was wrong by a factor of ~10.
I checked in 2 ways, the first i found some info on the net that these motors have about 36mohms, the second i reversed engineered the motor and used my motor calculator tool witch is proven to match reality about 95% (a few motors built by now with it) and it calculated it would have about 32mohms.
Then put the new resistance in the motor parameters FOC, and guess what, no more crossing sensored/sensorless problems, works like a charm. Man... i bashed my had half a year with that problem.... But, as Dave Johns (EEVBlog) says "i hope your project doesn't work, because then you'd learn something" and i sure did.
Went out did a test, man it goes, i pulled 3kw, 80A phase (limited) and 45km/h, it rips.
Now, can you describe in a few words how would you set up phase amps and battery amps (or battery power limiter) in a few words for land based vehicles.
Thank you.
 
Last edited:
Back
Top