Skip to content

Commit

Permalink
Create sensorless_foc.md
Browse files Browse the repository at this point in the history
  • Loading branch information
sahil-kale committed Jan 1, 2024
1 parent d42fa18 commit 4e96be8
Showing 1 changed file with 46 additions and 0 deletions.
46 changes: 46 additions & 0 deletions control_loop/bldc/docs/sensorless_foc.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Sensorless Field Oriented Control Observer
## Overview
From a high level, field oriented control is trying to orient the magnetic field produced by the stator to a particular vector (normally, +- 90 degrees or pi/2 rad to maximize torque production) relative to the rotational frame of the rotor (see the background FOC theory document for more information). In order to do this, we have to know the current electrical angle of the rotor to then know where to apply the current.

Note that the term 'sensorless' does not imply a lack of any sensing or a fully feedforward control system in this context, but rather refers to the lack of a position sensor on the rotor of a motor. Self-sensing is another term used in some papers, but (in the resources I came across) sensorless seems to be the common phraseology.

### Motivation
In a variety of BLDC/PMSM motor applications, the angle of the rotor (and by extension, the electrical angle of the rotor by taking into account the number of pole pairs) is determined by means of an external sensor. However, in applications where the standstill operation is not a normal design condition, it may be an attractive choice to consider a sensorless control algorithm to the number of components. Further, sensorless algorithms can improve redundency in applications where a failed rotor can have grave consequences (such as a motor for an aircraft) by providing an alternative way of commutating the motor without the use of an external sensor.

## Observers
The control problem considered for sensorless FOC is one where the alpha-beta frame currents, $i_{ab}$ (3 phase currents Clake transformed) and alpha-beta frame voltages $V_{ab}$ (feedforward applied phase voltages that are further clarke transformed) are known, and we would like to reconstruct the electrical angle $\theta$ for use in a field oriented control algorithm.

For the observers to work, parameters of the motor are also required to be known, such as the phase resistance and inductance, as well as permenant magnet flux linkage.

### Types of observers
In my research, I frequently came across 3 types of observers. I'll admit that the concepts of these have not intuitively clicked for me, but I will include them here alongside a brief overview of my understanding of these terms.

Sliding Mode Observers attempt to reconstruct the back electromotive force of the motor (when the motor acts like a generator). The back EMF generated by the motor is proportional to the speed of the rotor, and can be used to predict position by determining the back EMF of the rotor in the alpha-beta frame and then taking the tan-inverse. This method requires the rotor to be at speed before an accurate position measurement can be generated as back EMF is proportional to the speed.

Flux observers work by observing the amount of flux generated by the rotor in its phase windings and using this estimate to further inform the position of the rotor. In the first implementation for a flux observer, the paper compared the predicted motor flux to the actual permenant magnent flux value and used an observer to correct for those terms. Another paper (3) suggest using the flux zero crossings in a similar fashion to BLDC zero crossing detection.

High-Frequency-Injection methods work by injecting a high frequency voltage into the stator (the high frequency is to minimize actually moving the rotor) and then measuring the high frequency current. VESC (https://github.com/vedderb/bldc) is known for having gotten a HFI implementation working.

## Chosen Observer (Flux Observer, Ortega 2010)
I implemented an observer based on a paper (4) publised that develops a flux observer based off the phase resistance, inductance, permenant magnet flux, as well as the applied voltages and measured current. Here is my understanding of the paper so far for my own notes. I reference the paper's equations and state variables here as well as in the code.

First, we determine the flux driving voltage (y), which is the applied alpha-beta voltages (fed-forward) minus the stator's resistance and the alpha beta currents. This yields the flux driving voltages in the alpha-beta frame. Importantly, all of the variables in this function are available for measurement or are known quantities.

The paper suggest a new state variable, x (which is the total flux of the respective frame, both stator induced as well as the rotor flux linkage), which is the integral of the flux-driving voltage.

A vector function defined to be the frame's rotor flux $\eta$ (for both alpha and beta) is determined by subtracting the stator-induced flux (which is the frame current multiplied by the inductance) from the total flux (x). We recognize that if we take the norm of this 2d $\eta$ vector, which has the rotor flux in both the alpha and beta frame, we'll actually get the permenant magent flux (squared). I drew out a figure of this situation and how this would look in the vector frame below:

Paper 5) (which is used in reference 4) defines an observer in the form of a gradient-search by making an observer that tries to minimize the error between the permenant magnet flux and the predicted flux. This term features an observer gain, gamma, that is meant to be tuned for the observer. The observer state variable, x_hat_dot, attempts to predict the change total flux in each alpha-beta frame. This can then be integrated to find estimates for the total flux in each frame alpha-beta. From the definition of x, we see that theta can be inferred by re-arranging the definition of x to find a matrix definition of cos theta and sin theta, and dividing those 2 equations to equal tan theta, and then re-arranging to determine theta.

Some notes - this paper assumes that there is no saliency in the rotor as it means the inductance is not a function of theta. This makes it ideal for surface mount PMSM's, but it seems like interior PMSM's might suffer from inaccurate estimation given this.

## Open Questions
I'm not entirely sure in what situations which observer between SMO or Flux are better. I chose to implement the flux observer because I found the paper to be an easier read, but I not entirely sure which one is better. From 3) in the references section, the author claims that because "the rotor flux linkage is not a function of motor speed. The signal level remains constant at all speeds. Although they are mathematically related by just an integral transformation, the practical implication is that the flux observer can operate at lower speeds than a back EMF observer." This does make sense from the explaination, but I don't intuitively understand this concept just yet.


## References
1) https://imperix.com/doc/implementation/sensorless-motor-control
2) https://www.nxp.com/docs/en/reference-manual/DRM099.pdf
3) https://s3.amazonaws.com/scolton-www/motordrive/sensorless_gen1_Rev1.pdf
4) https://cas.mines-paristech.fr/~praly/Telechargement/Journaux/2010-IEEE_TPEL-Lee-Hong-Nam-Ortega-Praly-Astolfi.pdf
5) https://citeseerx.ist.psu.edu/document?repid=rep1&type=pdf&doi=ffaf8e3ad8cbfe675b57ba9e01729baf9e2043df

0 comments on commit 4e96be8

Please sign in to comment.