True FOC: definition and examples

john61ct

1 TW
Joined
Dec 18, 2018
Messages
8,758
I am not just interested in the smoothest possible torque-based control in challenging high-load low-rpm contexts, but also

maximum energy efficiency at all speeds, and

coordinating multiple unlike motors to work together as one.

I have been trying to nail down a set of criteria that define a "true FOC" controller.

Some features / phrases:
direct controller sensing of phase current / motor amps,

with current sensors on each phase connection in the motor providing a high bandwidth data stream,

controller performing CPU-intensive calculations and analysis of that data, to instantaneously predict the rotor angle / position in real time.

Do you think that captures the essentials? (anyone can answer of course)

If so, does for example the Lebowski design meet that criteria?
 
If you are familiar with FOC nomenclature then in my opinion any controller that is capable of controlling Iq and Id is a true FOC controller. On that basis the Lebowski controller qualifies. The fact that it is also capable of field weakening, acceleration limiting, angular velocity control, temperature and battery voltage scaleback, Hall sensor angle correction, CAN control, and constantly provides MTPA makes it the best motor controller on the planet. Compared to working with Sevcon controllers it is a dream come true.

If I have missed any important features hopeully Lebowski will chime in.
 
john61ct said:
Do you think that captures the essentials? (anyone can answer of course)
I think any controller that controls phase current angle based on an internal estimate of actual fields qualifies. To do that you also need the ability to create a specific phase current angle, of course, which means that straight PWM controllers don't qualify.
 
kiwifiat said:
If you are familiar with FOC nomenclature then in my opinion any controller that is capable of controlling Iq and Id is a true FOC controller.
I am not familiar with Iq nor Id.

I'm reading and googling for more, but if anyone's willing to ELI5 or link to a noob-friendly intro to this stuff I would appreciate the help.

Can only get so far with stuff like this:
https://www.motioncontroltips.com/faq-whats-the-difference-between-field-oriented-control-and-sinusoidal-commutation

 
Sabvoton

and the Grin PhaseRunner - apparently derived from a Sabvoton model?

are apparently true FOC, not controversial, correct?

Same with whatever is used on Zero electric motorcycles?

Are those proprietary, developed in-house?
 
FOC = Field Oriented Control.

That's all I know so far. Edit, people that I highly respect say FOC is the best way to control a motor, and the controller should have a shunt for each of the motor phase wires. Three wires, three shunts (or more)
 
In my very basic understanding:

Maximum torque/efficiency is achieved when the magnetic forces are tangential to the rotor, with no radial component. The radial component applies no useable force, and is wasted energy = heat.

Since the motor coils are inductors, there is a phase lag between voltage and current. And the magnetic field is created by current, not voltage.

Pure sinusoidal control doesn't take this into account, and applies voltage to the coils according to rotor position only. So the magnetic field (current) is slightly lagging and not optimised for maximum efficiency. Some energy is wasted as that non-usable radial force.

FOC measures/calculates that phase lag, and uses that information to adjust the applied voltage so the current (magnetic field) is optimised, in order to maximise the tangential forces and minimise the radial forces.

Please correct me if I'm wrong.
 
That is in line with pages I'm finding.

However very much over my head, given my lack of the most basic magnetic fields / motor fundamentals pre-requisite knowledge.

What I'm really after here, is clarification as to how to determine whether a given controller is true FOC or not.

 
One "controversial" example

The Powervelocity guy says

"FOC implementation in VESC is likely the best in its class. It is in fact FOC done the right way."

While others state they just use sinusoidal commutation - while better than trap type controllers (less ripple) - Powervelocity controllers are in fact not FOC at all.

 
john61ct said:
One "controversial" example

The Powervelocity guy says

"FOC implementation in VESC is likely the best in its class. It is in fact FOC done the right way."

While others state they just use sinusoidal commutation - while better than trap type controllers (less ripple) - Powervelocity controllers are in fact not FOC at all.

They are talking about different controllers. The vesc based are their new, not really released yet controller.
Their old controllers are modified chinese, not foc controllers
 
In my mind, field oriented control does the motor control in the rotor frame. So if the torque control is based on setting an iq and id current, that's FOC.

iq/id are the currents in the rotor reference frame. So if you are standing in the rotating rotor, you see DC currents instead of sinewaves.
media-1121509-focfig3.gif


This way the higher level control system just uses a single DC parameter and you can forget about time varying stuff of the sinewaves. Granted, sinewaves are happening, but that's unfolded from clarke/park transformations within the controller math.

If you are standing in the stator frame, you will see 3 sine waveforms. Mathematically you can reduce those 3 sines to 2 sines (alpha-beta) without losing information (clarke transform). Then if you know the field angle (in a PMSM equals to the rotor angle) you can do park transform to jump into the rotor frame and do the control there. Then inverse park and SVM will drive the PWM required to drive current into the motor

That's the basic stuff, you can see many variations like 5, 6 or 9 phase control, different angle observers, harmonic injection, mtpa, FW, non-SVM, etc, but they all can be reduced to a mechanism to transform the signals to the rotor frame (dc) to make control easier.
 
john61ct said:
One "controversial" example

The Powervelocity guy says

"FOC implementation in VESC is likely the best in its class. It is in fact FOC done the right way."

While others state they just use sinusoidal commutation - while better than trap type controllers (less ripple) - Powervelocity controllers are in fact not FOC at all.
Yes, probably best FOC is on VESC and because it is OpenSource and in C code, which makes much easier to learn from and adapt (just compare the many projects and available knowledge based on VESC).

Lebowski controller it is not OpenSource and it is written in assembly which makes it hard to learn from and adapt.

There are also the OpenSource firmware I wrote for 2 different cheap slow popular STM8 motor controllers and that do FOC but at "low resolution", still, users are very happy with the results (increase of motor torque and battery range)!!
 
marcos said:
if the torque control is based on setting an iq and id current, that's FOC.
Thanks! Yes, I've read about that stuff, but the complex maths involved in "how it works", phrases like ‘representing the total stator field as current space vectors’ is a bit abstract at my level.

As I search and read more I'll eventually start grokking that arena I'm sure, but I'm not asking for more of that to be posted here.

Let's try this approach: I'll post some "more basic" syllogisms like:
FOC works only with three-phase brushless DC (BLDC) motors that operate in sinusoidal mode.
for feedback.

Is that accurate? Are there exceptions?

I don't think (?) that is actually contradicted by:

BLDC aka trapezoidal motors, are **said** to typically have a trapezoidal back EMF waveform.

AKA "square-wave drives", but actually quasi-square waveform, aka modified square
However, the back EMF waveform is not truly trapezoidal in shape but more sinusoidal. Thus BLDC motors can use trapezoidal (aka direct current) or sinusoidal commutation.

Anything in all that, that is **not** accurate?



 
casainho said:
Yes, probably best FOC is on VESC and because it is OpenSource
Hi welcome and thanks for joining! Yes I'm a fan of FOSS, but do not want that aspect to be a derail here. Same with your project, but my current use case involves pushing 4-500lbs up long steep hills. . .

I want to also learn more about what VESC means (as opposed to what?) but again, not in this thread, later. . .

Finally, I would prefer to not get into comparisons between projects / controllers, except as pertinent to their implementation (or not) of "true FOC"

______
> firmware I wrote for 2 different cheap slow popular STM8 motor controllers and that do FOC but at "low resolution"

When you say "do FOC", does that involve:

a powerful processor doing Clarke & Park transform calculations

so that Quadrature/Torque (Iq) current vs Flux/Direct (Id) current are controlled directly, in order to as perfectly as possible

keep the stator current vector in orthogonal alignment (at 90 degrees) to the rotor flux?

If not exactly, then could you please explain as simply as possible what you mean by
FOC but at "low resolution"
?
Also, I assume your controller gets the rotor position information from an encoder rather than just Hall sensors?


 
john61ct said:
I have been trying to nail down a set of criteria that define a "true FOC" controller.
There are tons of literature about FOC.
I've developed an open source FOC firmware for the STM32-Lishui Controllers from scratch.

https://github.com/stancecoke/LishuiFOC

The links in the readme were very helpful for me. I followed the UM1052 - STM32F PMSM single/dual FOC SDK v4.3 step by step and got it working finally 8).

In the sensorless branch I implemented the observer that is used in the VESC project.

The "heart" of FOC, the Park- and Clark- (and inverse-) transformations are available in the arm_math libraries, so you don't have to care about the math itself.

regards
stancecoke
 
john61ct said:
casainho said:
Yes, probably best FOC is on VESC and because it is OpenSource
Hi welcome and thanks for joining! Yes I'm a fan of FOSS, but do not want that aspect to be a derail here. Same with your project, but my current use case involves pushing 4-500lbs up long steep hills. . .

I want to also learn more about what VESC means (as opposed to what?) but again, not in this thread, later. . .

Finally, I would prefer to not get into comparisons between projects / controllers, except as pertinent to their implementation (or not) of "true FOC"

______
> firmware I wrote for 2 different cheap slow popular STM8 motor controllers and that do FOC but at "low resolution"

When you say "do FOC", does that involve:

a powerful processor doing Clarke & Park transform calculations

so that Quadrature/Torque (Iq) current vs Flux/Direct (Id) current are controlled directly, in order to as perfectly as possible

keep the stator current vector in orthogonal alignment (at 90 degrees) to the rotor flux?

If not exactly, then could you please explain as simply as possible what you mean by

FOC but at "low resolution"
?

Also, I assume your controller gets the rotor position information from an encoder rather than just Hall sensors?
Go and see the source code, I put there the notes and reference resources, there is a function with FOC in the name.
 
Are there implementations of "true FOC but sensorless" out there in eBike use cases?
 
stancecoke said:
There are tons of literature about FOC
Yes, but mostly incomprehensible for noobs like me. But my comprehension is growing.

Thank you for linking to your references.

casainho said:
Go and see the source code, I put there the notes and reference resources, there is a function with FOC in the name.
Maybe I'll figure out how to do that, but my list of reading/research projects is fast exceeding time available.

If someone else is able to briefly answer those specific questions about casainho's implementation I'd appreciate it.


 
john61ct said:
Are there implementations of "true FOC but sensorless" out there in eBike use cases?

Yes of course, many e-bike manufacturers use sensorless motors (with Lishui controllers).
e.g. Fischer:
Fischer-E-Bike-proline-ETH-ETD-1606-neu-min.jpg


john61ct said:
If someone else is able to briefly answer those specific questions about casainho's implementation I'd appreciate it.

casainho is not using "typical FOC" with Clark/Park-transformations, the STM8 processors are too weak for that calculations. In the Kunteng-Project we are using the single phase current sensor to adjust the advance angle by the zero-crossing of the phase current and in the TSDZ2-project he uses a theoretical motor model (see Shane Colton's paper) to calculate the advance angle from the motor speed and the current.
There are only simple hall-sensors for the rotorposition detection in both approaches. The rotor angle is extrapolated from the hall signals.

shane_colton.PNG

regards
stancecoke
 
Thanks for the links again. OK, so different kinds of FOC, that's what's causing my discombobulation.

I'll use the phrase "true FOC" for now to represent
Using powerful processors to calculate Clark/Park-transformations, so that

Quadrature/Torque (Iq) current vs Flux/Direct (Id) current are controlled directly,

in order to as perfectly as possible

keep the stator current vector in orthogonal alignment (at 90 degrees) to the rotor flux
Unless there is a better short term out there, suggestions welcome.

Also feedback on that definition please.

______
So, **other** categories of FOC.

From your text, I infer three categories.

Are these mutually exclusive, or is there any overlap between them?

sensorless FOC
single sensor FOC
3-sensors FOC

Are there additional categories, or is four the right number?

Does the word "sensor" in all three of those category names refer to a Hall effect sensor specifically?

IOW does using a **different** sensor type instead (e.g. shunts) for measuring current, change **what kind** of FOC is being done?

Finally is it only "true FOC" (as I define that above) that uses both current sensors **and** an additional encoder?

 
spinningmagnets said:
That's all I know so far. Edit, people that I highly respect say FOC is the best way to control a motor, and the controller should have a shunt for each of the motor phase wires. Three wires, three shunts (or more)
Note that if you have three wires going to motor windings, due to Kirchoff's Current Law, once you know the current in two of the phases, you automatically know the current in the third. My first hybrid (Honda Civic Hybrid) had only two current sensors for the three phase traction motor for that reason.
 
john61ct said:
When you say "do FOC", does that involve:

a powerful processor doing Clarke & Park transform calculations

so that Quadrature/Torque (Iq) current vs Flux/Direct (Id) current are controlled directly, in order to as perfectly as possible

keep the stator current vector in orthogonal alignment (at 90 degrees) to the rotor flux?
That's one way to look at it, but I would note that many FOC's don't do much with the Id (since the magnets provide that field, and it can be assumed.) Better ones will oppose it to do field weakening for higher speeds.
 
JackFlorey said:
keep the stator current vector in orthogonal alignment (at 90 degrees) to the rotor flux
that's the gist of the matter (except situations, where you want to do field weakening by applying "too high" advance angles, or other specialities)

If the rotor position is detected by hall sensors or by a sensorless observer is irrelevant for FOC.

You have to find the right advance angle (like the pre-ignition in an internal combustion engine) for the voltage vector.

john61ct said:
Does the word "sensor" in all three of those category names refer to a Hall effect sensor specifically?
"sensorless" means no hall-sensors in the motor for the rotor angle detection.

phase current sensors can be simple shunts + opamps (e.g. in the lishui controllers) or hall-effect-based current sensors (like the acs711 in the Kunteng controllers). You can do FOC with one, two or three current phase sensors, see chapter 5 of the STM-Paper linked above.

regards
stancecoke
 
Back
Top