Doooooooo it. |

*sensorless*field-oriented control. The interpolated Hall effect sensor FOC I use now works great, even at low speed, the sensor costs $3 to implement, it's mostly reliable, and it's easy to fix. So of course it's my job now to make it twitchy and unreliable, especially at low speeds, and to eat the $3 cost savings by improving the current sensors.

And there are so many ways to do sensorless control of brushless motors...

Turnigy Sentilon 100A HV |

One way is just to buy a sensorless controller. Besides being a cop out, sensorless controllers like the one above are designed for voltage-controlled RC airplane duty. They use block commutation - driving two phases and measuring EMF on the third to determine rotor position. So, no field-oriented control, no sine waves, no current limting, and only crude start-up routines. Despite all that, a large enough RC plane ESC can sometimes be made to work well for small vehicles.

And sometimes not. |

What I'm more interested in is true field-oriented control without position sensors. This means sinusoidal commutation with a high-resolution rotor position estimate, and independent control of the torque-producing current (

*Iq*) and field-augmenting current (*Id*). With this type of control, all three motor phases are being driven at all times, so there is no opportunity to directly measure back EMF. Thus, a different way of deriving rotor position is required. Here's where the field diverges (lolpun) into several approaches:- Rotor position estimators that measure asymmetric rotor inductance using test pulses or high frequency injection. These have the advantage of working even at zero speed.
- Open-loop back EMF or flux observers, which require a good motor model.
- Closed-loop back EMF or flux observers, which are more forgiving.

There are at least two ways to detect the rotor position of a permanent magnet motor even at a standstill. If the rotor has saliency, its inductance is a function of electrical angle. Internal permanent magnet (IPM) motors are one good example of this, since the flux path through rotor steel changes as a function of angle. But surface permanent magnet (SPM) motors, like the ones I mostly encounter, have more-or-less constant inductance. The magnets themselves have close to the permeability of air, and the steel back-iron is rotationally symmetric.

A good sensorless algorithm could probably pick up the little magnet-retaining nubs, though... |

There's another way to statically determine the position of the rotor, which relies only on the fact that motors like this operate stator teeth very near to saturation. The flux density in the most "orange" teeth in the FEMM simulation above is about 1.8T. So, driving current into that tooth's winding would not be able to increase the flux as much in the positive direction as it would in the negative direction. (Also, the rise time would be faster in the positive direction.) A clever algorithm could pick out the rotor position based on this principle.

I don't really want to write a clever algorithm, though. Measuring inductance requires good high-bandwidth current sensing, which I don't currently have, to pick out the rise time in response to a voltage step. Also, this algorithm only applies to start-up unless you use high-frequency injection to measure inductance dynamically while the phases are being driven. I'm sure there are some magic ways to do this that are cleaner than I am imagining (Rainer Nase, I'm looking at you...), but right now it's not something I want to mess this.

Moving on, then, to open-loop observers.

An observer is a control structure that attempts to recreate states which are hidden from direct sensing. Generally, an observer requires some model of the plant, so a good place to start would be a model of a three-phase brushless motor.

Engineers do it with models. |

It would be nice to know the back EMF, but it's buried inside the black-box PMSM somewhere. Instead, we need to use maths:

The first maths is just stating KVL for the motor model.

*V*and*I*can be measured directly, and presumably we know*R*and*L*for a given motor, so solving for back EMF,*E,*shouldn't be a problem. If we know the back EMF, then we know the position of the rotor.The second maths is an alternative open-loop observer on

*rotor*flux linkage, which is just the integral of back EMF. This has some practical advantage over the first maths. Taking the derivative of the already-noisy current measurement will result in bad things, so even though they are physically equivalent, the smoothing integral formulation of the flux observer is more appealing in a noisy environment. Since rotor flux lines up with the permanent magnets, this also gives rotor position.The closed-loop observers go one step further.

The motor model is only valid if resistance and inductance are known. If the model parameters are off, the estimated states will also be off. A closed-loop observer attempts to correct for modeling error with feedback. Generally speaking, the closed-loop observer goes something like this:

- Input the drive voltage,
*V*, based on the PWM state. - Estimate the current,
*i**, based on the motor model and back EMF estimate. - Compare to the measured current,
*i*. - Feedback (i - i*) into the observer to modify the back EMF estimate.

"Fake motor" exists only in software. |

This is less dependent on having perfectly accurate resistance and inductance parameters. The linear version of this, called a Luenberger observer, is detailed in Mevey, Chapter 7. Since I learned pretty much everything I know about brushless motor theory from Mevey's thesis, I would give a lot of weight to his particular explanation.

There is also a slightly different feedback structure that I really like, called a sliding-mode observer. Instead of using the value of (i - i*), it uses only the sign of the error in what is aptly described as a Class D Error Amplifier, switching rapidly between a positive and a negative feedback path. The appeal of this method, covered well in Microchip AN1078, is that the switching structure clearly "eats" the current measurement noise. Right? ...... Right?

Anyway the sliding mode observer structure from AN1078 is the one I am most interested in trying, since it might even work on my existing hardware, crappy current sensors and all. The only question remaining is exactly

*which*current and back EMF are being observed.

**Down the rabbit hole of coordinate systems we go...**

Motor theory people seem to really like changing coordinate frames. Both the Luenberger observer and the sliding mode observer are most often presented as seeking the stator-frame components of current and back EMF. That is, two orthogonal components (α,β) on a coordinate plane that is tied to the stator, as opposed to (d,q) which is tied to the rotor. In a balanced three-phase system, this is a minimum set of information required to capture the state of the motor. And it makes sense to use this frame for the observed quantities because...

...because...I don't know why. They all seem to get the (α,β) flux or back EMF vector, then go back to rotor angle using an arctan function. Putting an arctan in my fast loop sounds like a horrible idea, and, excess processing power aside, I would like to avoid it if at all possible. So:

Why not observe the back EMF or the rotor flux on each phase? It's easy to do, since there are no coordinate transformations involved. The fast loop can certainly handle the numeric integration and sliding-mode compensator on all three phases. (It would have to do two components plus a coordinate transform and an arctan anyway.) But then how do you get to the rotor angle? Here is where I start digging a brand new rabbit hole...

I can get the rotor angle the same way I do now. All I need are fake Hall effect sensors for my fake motor.

Since I am observing back EMF or flux on each phase, I can easily (with if statements) detect zero crossings and flag a fake Hall effect sensor transition. This can then feed my existing controller, including the sine wave interpolation, with no modification at all. The rotor angle is calculated by the existing interpolation routine with no need for arctan. It's unconventional, which I like, but I really think it will work and it's simpler than what's out there.

So far, I'm ignoring the problem of start-up, the noisy current sensors, and many other practical issues like the fact that I can't yet program my controller wirelessly and it's buried in my scooter... I'll need to solve some of these in the near future before I can really test this out. But it's on the horizon, and now that it's in writing, I have to do it...

Somehow, you're always working on something that is pertinent to my interests. So, if you could solve it, design it, and have it manufactured in Hong Kong such I can buy it for <$100, that'd be super...

ReplyDeleteThat being said, have you looked at ESC's for cars from the RC realm? There are some sensorless ones that claim they can deliver smooth startup. Any idea if their architectures or startup algorithms are any different from the airplane & heli ESC's? Something like this:

http://www.hobbyking.com/hobbyking/store/uh_viewItem.asp?idProduct=10370

or this: http://www.hobbyking.com/hobbyking/store/uh_viewItem.asp?idProduct=14634

I have indeed looked at RC car controllers, including the Hobby King ones you mentioned. I think they are in general built to withstand high current startups a lot more than airplane ESCs. I'm not sure whether they just use more initial current or if they also have a better ramping algorithm.

ReplyDeleteThey're usually 2-4S LiPo, or 6S at most. I'm running 10S and I try to design my controllers for 12S (48V). Also, the RC controllers use block commutation (square wave drive) instead of field-oriented control (with sine wave drive). However, the price is right (not sure I could ever get my controller down to $100...maybe) and I would like to try the big one out on a lower-voltage, higher-current scooter.

Good Informative post

ReplyDelete