True FOC: definition and examples

Just to throw another definition out there, on page 38 of this ST presentation it states:
"The objective of the [FOC] algorithm is to control the vector components of the stator magnetic field (i.e. the phase currents) in order to obtain the target intensity and phase relation with the rotor magnetic field."

https://www.st.com/content/ccc/resource/sales_and_marketing/presentation/application_presentation/group0/23/a1/94/a3/39/cf/4c/37/introduction_to_electric_motors_pres.pdf/files/introduction_to_electric_motors_pres.pdf/jcr:content/translations/en.introduction_to_electric_motors_pres.pdf

There is also plenty of other good information/diagrams in the presentation.
 
Reference from @Bullfrog, not sure if a dupe

https://pdfs.semanticscholar.org/40ac/06d3db0b82242038c2dcd20c433d5d1c74f6.pdf
 
Factoid from another relevant thread on IPM specifically, using Lebowsky as an example.
https://endless-sphere.com/forums/viewtopic.php?f=30&t=105572&start=25#p1554542

amberwolf said:
Phase current sensors have nothing to do with motor position sensors.
Aren't the latter what is referred to as "encoders"? Are either also referred to as "resolvers"?

I inferred from the above that FOC calculations could be (usually are at least in the ebike world?) based on instantaneous tracking of the individual phase current levels.

Also, any clarification as to how "true FOC" can work in a sensorless setup would be greatly appreciated.
 
relevant thread https://endless-sphere.com/forums/viewtopic.php?p=1561230#p1561230
 
Vector control for dummies is a very good read with some excellent animations: https://www.switchcraft.org/learning/2016/12/16/vector-control-for-dummies
 
bww129 said:
Vector control for dummies is a very good read with some excellent animations: https://www.switchcraft.org/learning/2016/12/16/vector-control-for-dummies
Wow, thanks!
 
Prof. Kirtley gives a definition in his MIT course notes (Chapter 7, Section 3.3)
https://ocw.mit.edu/courses/electri...685-electric-machines-fall-2013/course-notes/
For high performance drives, we will generally assume that the power supply, generally an inverter, can supply currents in the correct spatial relationship to the rotor to produce torque in some reasonably effective fashion. We will show in this section how to determine, given a required torque (or if the torque is limited by either voltage or current which we will discuss anon), what the values of Id and Iq must be. Then the power supply, given some means of determining where the rotor is (the instantaneous value of θ), will use the inverse Park’s transformation to determine the instantaneous valued required for phase currents. This is the essence of what is known as “field oriented control”, or putting stator currents in the correct location in space to produce the required torque.
 
Clear statement from VasiliSk wrt the Nucular line

https://endless-sphere.com/forums/viewtopic.php?p=1596242#p1596242
 
Your well above me on this but I can give some real world data from the same test mule with from 3 differing types of controller.

The motor is a cheap my1020 48v 1600w (didn't want to burn out anything fancy) and picked a complete scooter up £90 fee years ago it was a steal guy couldn't adjust the chain proper city guyich richer than me so each have they own uses but no to topic
Square wave 2.2kw would get it boiling hot climb 300m 20% incline tap out time

Same climb trapiz controller with a 125% over speed which I think is a set amount of field weakening by the controller non programable set to 4.4kw max on the stunts same climb it would take 2 runs to get the same heat yet i got to the top nearly half the time.so much less heat seemed to made.

Then a vesc 6.6 no field weakening in FOC 2.8kw and I can go up and down till the battery dies there's less heat for sure and the sound is much smoother the range went from 16 miles to 20 but my speed dropped 12 mph or so to dropping volts etc.

I'll be converting my bike to FOC in time it's a no brainer only difference being I won't have to take a power drop so that will be a win win.

Hope thats not to far of topic as I've not mentioned vector algorithms etc.
 
Lebowski said:
john61ct said:
Also, any clarification as to how "true FOC" can work in a sensorless setup would be greatly appreciated.

You can read the explanation of my stuff here :
https://endless-sphere.com/forums/viewtopic.php?f=30&t=104895#p1533225

Lebowski's controller and explanation is fantastic, and even more so when you realise he wrote the whole lot without knowing about Clark and park but perhaps doesn't answer your question concisely.

Any FOC algorithm requires knowledge of the rotor angle at any instant. FOC does not implicitly know this... Something else has to determine the angle.

In lebowskis code, the loop filters are essentially doing this. I'm not picking through his assembly to work it out exactly. In ST library there is a phase locked loop based on a luenburg observer (it makes a prediction of the next measured current given it's current knowledge of speed, voltage, and position, then adjust itself given the error observed in the prediction when it next measures current) in vesc i think it is done by integrating the observed voltages and knowing that over a revolution the integral will equal zero (equal positive and negative).

Once the angle is known, the FOC proceeds as normal with no knowledge as to where the angle measurement came from.

Interestingly, sensor less algorithms can be more accurate than sensored since they are directly taken from the magnetic field not assumed from accurate encoder/Hall alignment.

Writing the code for my version of it now, I'm realising at the moment is a complete :bolt: :flame: :warn: :warn: ing nightmare. The principle is fairly easy, the reality when you do it is that minor errors make everything just go into random oscillation mode.
 
I'll add to the above that typically, observers of whatever type are done in the 2 phase alpha beta frame (after Clark transform) since 1) at high voltages one phase won't have good measurements of current and 2) why mess with 3 phases when you have two nice perpendicular ones that are much easier to deal with.

Starting the motor is tricky. Low speed gives high densities error so usually algorithms just feed max possible current into the stator and then switch to the observer once it's spun up to speed.
 
mxlemming said:
in vesc i think it is done by integrating the observed voltages and knowing that over a revolution the integral will equal zero (equal positive and negative).
VESC cites this paper and uses only relatively few lines of code to update the phase:
http://cas.ensmp.fr/~praly/Telechar...EE_TPEL-Lee-Hong-Nam-Ortega-Praly-Astolfi.pdf
Code:
const float L_ia = L * i_alpha;
const float L_ib = L * i_beta;
const float R_ia = R * i_alpha;
const float R_ib = R * i_beta;
const float lambda_2 = SQ(conf_now->foc_motor_flux_linkage);
...
float err = lambda_2 - (SQ(*x1 - L_ia) + SQ(*x2 - L_ib));
float x1_dot = -R_ia + v_alpha + gamma_half * (*x1 - L_ia) * err;
float x2_dot = -R_ib + v_beta + gamma_half * (*x2 - L_ib) * err;
*x1 += x1_dot * dt;
*x2 += x2_dot * dt;
...
*phase = utils_fast_atan2(*x2 - L_ib, *x1 - L_ia);
v_alpha, v_beta and i_alpha, i_beta are the measured voltages and currents in the stator frame. I thought this reference was a little clearer:
https://doi.org/10.1109/TCST.2010.2047396
They do integrate the observed voltages (and include resistance and inductance effects). But I don't see where they integrate over a revolution. TBH, I'm still trying to understand the basics of this paper though.
 
ProgramThyself said:
v_alpha, v_beta and i_alpha, i_beta are the measured voltages and currents in the stator frame. I thought this reference was a little clearer:
https://doi.org/10.1109/TCST.2010.2047396
They do integrate the observed voltages (and include resistance and inductance effects). But I don't see where they integrate over a revolution. TBH, I'm still trying to understand the basics of this paper though.

The integration over a revolution is not done by the code, it's a property of the motor that means the above code works. If it were not a property, those integrals would fly off to infinity. Since it is a property of the motor, the x1 and x2 are oscillatory around zero with the frequency of rotation, and a phase difference (90 degrees) which allows angle calculation by arctangent.
 
mxlemming said:
in vesc i think it is done by integrating the observed voltages and knowing that over a revolution the integral will equal zero (equal positive and negative).
mxlemming said:
The integration over a revolution is not done by the code, it's a property of the motor that means the above code works. If it were not a property, those integrals would fly off to infinity. Since it is a property of the motor, the x1 and x2 are oscillatory around zero with the frequency of rotation, and a phase difference (90 degrees) which allows angle calculation by arctangent.
In a hypothetical situation the motor could always rotate faster during one part of the electrical cycle and slower during the other. Then v_alpha would not necessarily integrate to zero. But I think the observer would still work because of the additional terms in the update equation.
 
ProgramThyself said:
In a hypothetical situation the motor could always rotate faster during one part of the electrical cycle and slower during the other. Then v_alpha would not necessarily integrate to zero. But I think the observer would still work because of the additional terms in the update equation.

Not the case. The integral remains the same regardless of speed, since as speed increases, back emf also increases, while the integral time goes down.

This is a pretty much fundamental property of any motor, the integral of back emf over a revolution remains constant, and is determined by the magnetic field strength, the number of poles and the number of turns.
 
mxlemming said:
ProgramThyself said:
In a hypothetical situation the motor could always rotate faster during one part of the electrical cycle and slower during the other. Then v_alpha would not necessarily integrate to zero. But I think the observer would still work because of the additional terms in the update equation.

Not the case. The integral remains the same regardless of speed, since as speed increases, back emf also increases, while the integral time goes down.

This is a pretty much fundamental property of any motor, the integral of back emf over a revolution remains constant, and is determined by the magnetic field strength, the number of poles and the number of turns.

The voltage is the derivative of magnetic flux. So integrating voltage gives magnetic flux, for a coil this equates to 0 after a north and a south poled have passed a coil.
 
Lebowski said:
mxlemming said:
ProgramThyself said:
In a hypothetical situation the motor could always rotate faster during one part of the electrical cycle and slower during the other. Then v_alpha would not necessarily integrate to zero. But I think the observer would still work because of the additional terms in the update equation.

Not the case. The integral remains the same regardless of speed, since as speed increases, back emf also increases, while the integral time goes down.

This is a pretty much fundamental property of any motor, the integral of back emf over a revolution remains constant, and is determined by the magnetic field strength, the number of poles and the number of turns.

The voltage is the derivative of magnetic flux. So integrating voltage gives magnetic flux, for a coil this equates to 0 after a north and a south poled have passed a coil.
I think I mangled my words a bit... I meant at any angle within a revolution the integral should remain constant... Or the integral between any two given angles... Like if you start integrating from 0 angle then at X degrees regardless of the speed your integral should be the same. And over the full 360 degrees it should be 0.

Lebowskis explanation is good. Nice and visual.
 
mxlemming said:
ProgramThyself said:
In a hypothetical situation the motor could always rotate faster during one part of the electrical cycle and slower during the other. Then v_alpha would not necessarily integrate to zero. But I think the observer would still work because of the additional terms in the update equation.

Not the case. The integral remains the same regardless of speed, since as speed increases, back emf also increases, while the integral time goes down.

This is a pretty much fundamental property of any motor, the integral of back emf over a revolution remains constant, and is determined by the magnetic field strength, the number of poles and the number of turns.
Lebowski said:
The voltage is the derivative of magnetic flux. So integrating voltage gives magnetic flux, for a coil this equates to 0 after a north and a south poled have passed a coil.

You're both right, my example was flawed. But I think current could still be adjusted during each revolution to make the time integral of v_alpha be non-zero for one revolution. After all, the effective magnetic flux can be modified by changing i_d, field-strengthening during one half and weakening during the other half revolution. That may seem contrived, but the observer will surely receive noise inputs with those components and shouldn't random-walk all over the place.

Edit: I'm trying to make two points here: 1. I don't believe this conservation law exists where the time integral of v_alpha is claimed to be zero over each revolution (but admittedly I could be wrong). 2. The observer does not rely on such a law, because the observer is still stable even if noise or commanded behavior make the integral deviate from zero.

Edit #2: I appreciate the explanations. Questioning things is how I learn. Thanks for the technical discussion.
 
ProgramThyself said:
You're both right, my example was flawed. But I think current could still be adjusted during each revolution to make the time integral of v_alpha be non-zero for one revolution. After all, the effective magnetic flux can be modified by changing i_d, field-strengthening during one half and weakening during the other half revolution. That may seem contrived, but the observer will surely receive noise inputs with those components and shouldn't random-walk all over the place.

Edit: I'm trying to make two points here: 1. I don't believe this conservation law exists where the time integral of v_alpha is claimed to be zero over each revolution (but admittedly I could be wrong). 2. The observer does not rely on such a law, because the observer is still stable even if noise or commanded behavior make the integral deviate from zero.

Edit #2: I appreciate the explanations. Questioning things is how I learn. Thanks for the technical discussion.

Integrating v_alpha does not necessarily add up to zero, because of phase resistance and inductance. But that is not the same as integrating the observed voltages - note in the VESC code you posted, the v_alpha and v_beta are adapting to account for resistance and inductance and then integrating. You need to be specific about what is and is not another value...

The observer is stable because it contains correction- the float err = lambda2... etc... is rolled into it and drags the result back towards zero in the event of noise, error etc.

Code:
const float L_ia = L * i_alpha;
const float L_ib = L * i_beta;
const float R_ia = R * i_alpha;
const float R_ib = R * i_beta;
const float lambda_2 = SQ(conf_now->foc_motor_flux_linkage);
...
float err = lambda_2 - (SQ(*x1 - L_ia) + SQ(*x2 - L_ib));
float x1_dot = -R_ia + v_alpha + gamma_half * (*x1 - L_ia) * err;
float x2_dot = -R_ib + v_beta + gamma_half * (*x2 - L_ib) * err;
*x1 += x1_dot * dt;
*x2 += x2_dot * dt;
...
*phase = utils_fast_atan2(*x2 - L_ib, *x1 - L_ia);
 
Google released all the code for the Makani wind kite project on github.
The motor firmware (for the TMS570) runs the Yasa motors, and yes it is "true FOC":

https://github.com/google/makani/tree/master/avionics/motor/firmware

Very nice code with great comments, as one might expect from a Google X project .
 
From Amberwolf, elsewhere and closely paraphrased:

Per-phase current sensing is required for FOC

though it is not required for sinusoidal control

_____
but I thought true FOC was possible completely sensorless?
 
john61ct said:
From Amberwolf, elsewhere and closely paraphrased:

Per-phase current sensing is required for FOC

though it is not required for sinusoidal control

_____
but I thought true FOC was possible completely sensorless?

"sensorless" (no hall sensors in motor) has absolutely nothing to do with current sensing (in controller).

This was covered earlier in this thread, such as here:
https://endless-sphere.com/forums/viewtopic.php?f=30&t=105139#p1537712
 
Back
Top