You are here

Flux linkage observer @ low speed

10 posts / 0 new
Last post
soltesz
Offline
Last seen: 1 year 6 months ago
Joined: 2017-12-16 15:18
Posts: 6
Flux linkage observer @ low speed

Hello, I'm happy to have found this excellent resource - thanks!

I'm particularly curious about the flux linkage observer, and how it can could be improved to get even better low-speed performance. The observer is implemented in observer_update in mcpwm_foc.c (e83af32) and appears (from the comments in the same file) to be based on a method by Hong et al. Reading the paper, the main strengths appear to be that the angle estimator does not involve the (estimated) angular velocity) and that it is straightforward to implement. The main weakness, also pointed out in the paper, is that observability is lost at zero angular velocity, which is obvious as there is no back-EMF at standstill (after possible transients have faded).

Here's a bunch of topics for discussion and possible implementation that came to mind:

1. Has anyone here tried/thought about  improved angle estimation at low speeds? Perhaps using HF signal injection to retrieve observability?

2. The stator resistance changes with temperature and there seems to exist several techniques for estimating them online. Two possible reasons for doing this would be to use the online estimates as input to the thermal protection algorithm, and 2) improve performance of the flux linkage observer when the motor runs (or starts) hot.

3. The VESC code seems to (correct me if I am wrong!) assume that all three stator winding groups have constant and identical inductance and internal resistance. Looking quickly at the implementation and underlying models, I don't see a problem in identifying individual values La, Lb, Lc and Ra, Rb, Rc for the three stator winding groups, again with the intention to improve flux linkage estimation.

I have not yet made any simulations, and perhaps the "improvements" suggested in 2 and 3 are practically negligible. I'd be happy to hear your thoughts on this.

Cheers,
Kris

 

ThierryGTLTS
Offline
Last seen: 5 years 7 months ago
Joined: 2017-09-06 14:18
Posts: 116

1. Lebowski uses a tone to start the motor (not the VESC, see Endless Sphere).

2. Yes it would be better, and a NTC sensor in the windings can help.

3. Not sure it's interesting.

But I know only a little part of the code.

Have a Nice Day.

Thierry

soltesz
Offline
Last seen: 1 year 6 months ago
Joined: 2017-12-16 15:18
Posts: 6

Hi Thierry,

Thanks for the input.

1. Lebowski uses a tone to start the motor (not the VESC, see Endless Sphere).

Yes, that type of thing. I was not able to find the exact method the Dude is using over at ES (probably there somewhere, but lots of search hits). Found some papers describing what I guess is the same (or very similar) technique though. A readable implementation-oriented example is for instance DOI: 10.1109/TPEL.2007.904238.

2. Yes it would be better, and a NTC sensor in the windings can help.

I was thinking it would be better to estimate the resistance directly, or else the temperature-resistance dependence would need to be charactarized for each particular motor first. Estimating the resistance directly seems straight-forward (if I have not missed something fundamental). I won't have time to implement in very near future, so figured I could share what I have in mind here in the meanwhile:

Let's consider one of the windings (model for the motor similar, but messy with all indices here):

v(t) - kv * dx(t)/dt -R*i(t) - L*di(t)/dt = 0,

where v is the voltage vector, i the current vector, kv the back-emf constant, x the electric angular position (normally denoted theta_e), R the resistance, L the  inductance (all expressed in the same coordinate system, either of [d,q], [alpha,beta] or [a,b,c]). Looking at the schematic, it appears the VESC 6 has individual measurements of V and i for all three winding groups. Integrating the above equation gives us

V(t) - kv * x(t) - R *I(t) - L * i(t) = 0,

where V and I are the integrals of v and i (from some arbitrary start time) up until time t. (They can be computed using for instance trapezoidal rule and stored in ring buffers.) Since we expect the resistance to change, we choose the start time t-T, to be far enough back in time to avoid noise issues, and close enough to track changes in R. Probably something on the magnitude of seconds would do, depending foremost on thermal mass of the particular motor. We now have

[V(T)-V(t)] - kv*[x(T) - x(t)] -R*[I(T)-I(t)] - L*[i(T)-i(t)] = 0,

and can obtain our estimate

R = - ( [V(T)-V(t)] - kv*[x(T) - x(t)] - L*[i(T)-i(t)] ) / [I(T)-I(t)]

Note: Some care needs to be taken when evaluating x (which should not be mod 2*pi) and to update the estimate of R close to maxima of I(T)-I(t) to avoid numerical issues. The angle x could be conveniently used to determine if it is appropriate to update the estimate of R. It is probably a good idea to also require that the motor has experienced a minimum number of ? (electrical) revolutions during the estimation window, to get an OK SNR.

Note: Online estimation of R would for instance mean that you don't have to re-run identification via vesc-tool if changing to longer or shorter battery cables (mostly relevant for ebikes).

Note: Another extra feature could be to implement some roll-back whenever resistance has fallen more than ? % from nominal, in order to prevent damage from over-heating.

3. Not sure it's interesting.

Neither am I, but quick measurement on my bicycle hub motor reveals differences between the three winding groups in the 1-10 % range in both inductance (LRC-meter @ 20 kHz) and resistance, suggesting that there *might* be some performance to gain by identifying them individually.

 

 

benjamin
Offline
Last seen: 2 days 14 hours ago
VESC FreeVESC OriginalVESC Platinum
Joined: 2016-12-26 15:20
Posts: 490

I have been experimenting with online resistance estimation similar to what you describe, but I did not have much success with it. What you essentially are describing is to take difference between the generated back emf and the applied voltage, and divide that by the current. The problem is that the resistance usually is very low, so already at quite low speeds the back emf voltage will be large compared to the voltage drop over the winding, causing bad SNR. This means that the current has to be extremely high for the voltage drop to come anywhere close to the back emf voltage. In my experiment I made the estimation in the dq frame using the output from the speed tracker, but I did not spend much time on it. It would be nice if you can do some experiments and see if you can get any better results.

Signal injection is high on the priority list and I would like to get started with that soon. Even if the angle estimation only has an accuracy of 30 electrical degrees it would be a huge help to start the motor. Let me know if you want to have a look at that, I can try to help if there is anything I can do.

ThierryGTLTS
Offline
Last seen: 5 years 7 months ago
Joined: 2017-09-06 14:18
Posts: 116

It would be interesting to implement the signal injection.

Lebowski has some knowledge about that.

And I think Maxon also use it in some of their controllers, and also use a DRV8301.

Have a Nice Day.

Thierry

soltesz
Offline
Last seen: 1 year 6 months ago
Joined: 2017-12-16 15:18
Posts: 6

Thanks, sounds great. I did some reading up and indeed it seems to be a known problem that the SNR becomes very for my naive stator resistance estimation technique (unless you have a crappy motor with really high resistance or/and you load it really hard). There seems to exist several published alternatives, of which some rely on signal injection schemes. All in all this sounds like a nice student project to look deeper into. I'll suggest it and will let you know if any students show interest in the proposal and come up with something worthwhile.

Regardinfg signal injetion, I'll be on parental leave abroad during the spring, so won't have access to lab and all that. But I'd be happy to read/discuss literature signal injection during this period, if that is of any help.

Thanks also Thierry for pointing at Leowski using signal injection in his project. If you know him, perhaps you can ask him for details/references and post here if you come up with something interesting/useful?

benjamin
Offline
Last seen: 2 days 14 hours ago
VESC FreeVESC OriginalVESC Platinum
Joined: 2016-12-26 15:20
Posts: 490

I think signal injection can be used for resistance estimation as well as you mention, so if you have time it would be nice if you can read about that a bit. If I find time I will have a look at some signal injection myself as well.

Roger Wolff
Offline
Last seen: 1 year 10 months ago
VESC Original
Joined: 2017-05-24 12:27
Posts: 202

...the current has to be extremely high for the voltage drop to come anywhere close to the back emf voltage.

What the BEMF voltage is doesn't matter. The voltage drop across the resistance can always be expressed as I*R and will always  be a small number of ADC  counts independent from the back EMF.  On a standard VESC you can measure about 60V, and with a 15 mOhm motor (e.g. DT750) and 10A of current you get 0.15V. This is 0.25% of the measuring range, so about 10 ADC counts. 

 

But as we're not measuring the voltage, but assuming our PWM applies a voltage to the motor. Right?

 

I always say that you don't have to mess with three phases and just think of a old fashioned brushed motor when dealing with KV, BEMF, currents and voltages. If that's the case, it would seem that an increase in resistance is indistinguishable from a slight increase in the amount of mechanical work done. My hypothesis is: this still holds for a three phase BLDC motor. 

 

soltesz
Offline
Last seen: 1 year 6 months ago
Joined: 2017-12-16 15:18
Posts: 6

For starters, I think this article http://ieeexplore.ieee.org/document/5456815/ (PM me if you don't have access) gives a plain and comprehensive introduction to the HF model used for position estimation at standstill. I am sure you are already aware of this since you have started implementing a zero (low) speed position estimator.

This article http://ieeexplore.ieee.org/stamp/stamp.jsp?arnumber=5546935 discusses signal injection in order to estimate stator resistance. The intuition is that we want a DC component along the direction we are looking, making the inductive term disappear. It is a good idea to inject along the d axis since this (ideally) results in no torque ripple in the absence of flux linkage in that direction. I think a good first shot would be to introduce field weakening (taking care to staying within constraints of the system) and then integrating the electric d-direction equation vd = R*id+Ld*did/dt- w*Lq*iq wrt time and solve for R. The particular paper then mentions that it is wise not to add the field weakening voltage vd as a step function to avoid exciting HF resonances. The paper makes use of a Blackman filter, but probably anything sufficiently smooth will do. Then they talk about signal separation of the injected voltages from motoring and harmonic voltages. I think it would be interesting to first plot id and vd under normal operation (I'm waiting for 2 ordered vesc 6, so cannot do it on the fly). If the FOC is working well, these two signals should be very quiet and so perhaps the proposed signal separation is not needed. At any rate, it is mathematically uncomplicated.

There seems to be a multitude of very similar methods published. All I have found have in common that position estimation at standstill is based on HF injection, while resistance estimation is based on DC injection (which makes sense from the physics).

Btw, a question which could be mildly related (at least relevant if I run some simulations): When you run FOC in torque control (d reference 0) and release the throttle, does the vesc continue to perform SVM (which results in a close to zero torque) or does it simply "release the motor by closing all 6 inverter gates?

 
benjamin
Offline
Last seen: 2 days 14 hours ago
VESC FreeVESC OriginalVESC Platinum
Joined: 2016-12-26 15:20
Posts: 490

What the BEMF voltage is doesn't matter. The voltage drop across the resistance can always be expressed as I*R and will always  be a small number of ADC  counts independent from the back EMF.

Yes, but the voltage you measure is I*R + BEMF, meaning that R = (U - BEMF) / I. The problem here is that U can be very small compared to BEMF and thus a small error in the flux linkage measurement or speed (used to calculate BEMF) has a big impact on the error.

Thanks for the links, I can access them from my university account. I already have a bunch of papers on signal injection, ans as you say they use similar techniques that are not too complicated mathematically.

Btw, a question which could be mildly related (at least relevant if I run some simulations): When you run FOC in torque control (d reference 0) and release the throttle, does the vesc continue to perform SVM (which results in a close to zero torque) or does it simply "release the motor by closing all 6 inverter gates?

When you release the throttle all the FETs are switched off and the motor is tracked using the BEMF phase voltages measured by the ADC for running the observer. The transition between driven and undriven is smooth and seamless as I have been tweaking it quite a bit to get everything right regarding timing and starting modulation in the correct state.